Overview

  • Talk about Square
  • Show off the drupal integration
  • Demo our Point of Sale APIs
  • Questions, comments, concerns, excitements
Setting up a DrupalVM
Open it up!
Open up a terminal inside it
Generate ssl certificates

						openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout example.key -out example.crt
					
rename drupal configuation

						mv example.drupal.make.yml drupal.make.yml
					
Copy Vagrant config.yml

						cp default.config.yml config.yml
					
Make some important additions

						open config.yml
					

#enable the bcmath PHP extension
php_packages_extra:
  - "php{{ php_version }}-bcmath"

#get some crappy form of SSL going.
apache_vhosts_ssl:
  - servername: "{{ drupal_domain }}"
    documentroot: "{{ drupal_core_path }}"
    certificate_file: "/vagrant/example.crt"
    certificate_key_file: "/vagrant/example.key"
    extra_parameters: |
          ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000{{ drupal_core_path }}"
					
Start the magic

						vagrant up
					

...and a work around for High Sierra see geerlingguy/drupal-vm issue #1547

  • Disc Utility
  • File->New Image->Blank Image
  • MAC OS Extended
  • Copy files to new volume
This is fixed in MacOS 10.13.2
Start the magic

						vagrant up
					

How are you different from....?

Building a commerce platform


					
					

var paymentForm = new SqPaymentForm({

	// Initialize the payment form elements
	applicationId: applicationId,
	locationId: locationId,

	// Initialize the credit card placeholders
	cardNumber: {
		elementId: 'sq-card-number',
		placeholder: '•••• •••• •••• ••••'
	},
	cvv: {
		elementId: 'sq-cvv',
		placeholder: 'CVV'
	},
	expirationDate: {
		elementId: 'sq-expiration-date',
		placeholder: 'MM/YY'
	},
		postalCode: {
		elementId: 'sq-postal-code'
	},
})

Styling


		inputStyles: [{
			fontSize: '14px',
			padding: '7px 12px',
			backgroundColor: "transparent"
		}],
	

Apple Pay


// Initialize applePay placeholder ID
applePay: {
  elementId: 'sq-apple-pay'
}

Masterpass


// Initialize Masterpass placeholder ID
masterpass: {
  elementId: 'sq-masterpass'
}
Pay with a Credit Card
Card Number:
CVV:
Expiration Date:
Postal Code:

Pay with a Digital Wallet


Masterpass not enabled
ssdf
ss
sss
sss
Card Nonce:

Charge Endpoint


            			POST /v2/locations/LOCATION_ID/transactions  {

	            			"idempotency_key": "74ae1696",
	            			"amount_money": {
		            			"amount": 5000,
		            			"currency": "USD"
		            		},
		            		"card_nonce": "card_nonce_from_square_123"
		            	}
            

        		curl -X POST \
        		https://connect.squareup.com/v2/locations/CBASEM9Ry3uB-6qCeuoZP6wRR7k/transactions \
        		-H 'authorization: Bearer sq0atb-tsn132D7btUhW3uL_y5I3w' \
        		-H 'content-type: application/json' \
        		-d '{
        		"idempotency_key": "",
        		"amount_money": {
        		"amount": 100,
        		"currency": "USD"
	        	},
	        	"card_nonce": ""
		        }' | python -m json.tool
Recurring payments?

Create a customer


			curl -X POST \
			https://connect.squareup.com/v2/customers \
			-H 'authorization: Bearer sq0atb-tsn132D7btUhW3uL_y5I3w' \
			-H 'content-type: application/json' \
			-d '{
			"given_name": "Veronica",
			"family_name": "Slocombe",
			"email_address": "V.Slocombe@example.com",
			"note": "an exceptional customer"
			}' | python -m json.tool
	
Create a card Nonce
ssdf
ss
sss
sss
Card Nonce:

attach to customer:


		curl -X POST \
		https://connect.squareup.com/v2/customers//cards \
		-H 'authorization: Bearer sq0atb-tsn132D7btUhW3uL_y5I3w' \
		-H 'content-type: application/json' \
		-d '{
		"card_nonce": "",
		"billing_address": {
		"address_line_1": "500 Electric Ave",
		"address_line_2": "Suite 600",
		"locality": "New York",
		"administrative_district_level_1": "NY",
		"postal_code": "11111",
		"country": "US"
		},
		"cardholder_name": "Amelia Earhart"
		}' | python -m json.tool

Charge


		curl -X POST \
		https://connect.squareup.com/v2/locations/CBASEM9Ry3uB-6qCeuoZP6wRR7k/transactions \
		-H 'authorization: Bearer sq0atb-tsn132D7btUhW3uL_y5I3w' \
		-H 'content-type: application/json' \
		-d '{
		"idempotency_key": "",
		"amount_money": {
		"amount": 100,
		"currency": "USD"
		},
		"customer_id":"",
		"customer_card_id":""
		}' | python -m json.tool

List Transactions


		curl -X GET \
		https://connect.squareup.com/v2/locations/CBASEM9Ry3uB-6qCeuoZP6wRR7k/transactions \
		-H 'authorization: Bearer sq0atb-tsn132D7btUhW3uL_y5I3w' \
		| python -m json.tool
	

Square Checkout


			curl -X POST \
			https://connect.squareup.com/v2/locations/CBASEM9Ry3uB-6qCeuoZP6wRR7k/checkouts \
			-H 'authorization: Bearer sq0atb-tsn132D7btUhW3uL_y5I3w' \
			-H 'content-type: application/json' \
			-d '{
			"idempotency_key": "",
			"order": {
			"line_items": [{
			"name": "Spikey Succulent",
			"quantity": "2",
			"base_price_money": {
			"amount": 1500,
			"currency": "USD"
			},
			"discounts": [{
			"name": "15% off mean looking item",
			"percentage": "7"
			}]
			}],
			"taxes": [{
			"name": "Sales Tax",
			"percentage": "8.5"
			}]
			},
			"redirect_url": "https://giphy.com/search/happy"
			}' | python -m json.tool
http://dashboard.drupalvm.test/
http://drupalvm.test/

install Commerce Square Connect


			cd drupal
			composer require drupal/commerce_square
		

Setting up the module

login


			user: admin
			passsword: admin
		
Extend
Commerce

SQU.RE/TRISTAN