e-commerce
Charge Endpoint
POST /v2/locations/LOCATION_ID/transactions {
"idempotency_key": "74ae1696-b1e3-4328-af6d-f1e04d947a13",
"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
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
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": "15"
}]
}],
"taxes": [{
"name": "Sales Tax",
"percentage": "8.5"
}]
},
"redirect_url": "https://giphy.com/search/happy"
}' | python -m json.tool
Point of Sale API