POST /pay/cart

Payment API to pay for a current shopping cart.

Please note that this is an SSL only endpoint.

Post Parameters

Parameter Type Description Examples
_launch_ly_session (required) BSON id The id of the variant which price need to be checked. 506bb8b357817e56bb000032
reference (required) string The cart order_reference 1abc234d
first_name (required) string The first name on the payment card Craig
last_name (required) string The last name on the payment card Sullivan
card_number (required) string The payment card number 4444333322221111
payment_type (required) string The payment card type. One of visa, master or american_express visa
expires_month (required) integer The expiry month 9
expires_year (required) integer The payment card expiry year 2019
card_verification (required) string The three or four digit card verification number 123

Response Parameters

Parameter Type Description
domain string The domain name for which this payment took place.
action string The requested payment action.
amount decimal The amount of the transaction.
success string The success (or failure) message from the payment gateway.
message string The message passed back from the payment gateway.
reference string The order reference.
order json Details on the order if payment was successful.
coupon_code string Coupon code (if used)
first_name string The first name for who this order is for.
last_name string The last name who this order is for.
billing_line1 string Line one of the billing address.
billing_line2 string Line two of the billing address.
billing_suburb string The town or suburb of the billing address.
billing_state string The state of the billing address.
billing_state_name string The name of the state of the billing address.
billing_state_other string Field for an alternative state or province name for the billing address.
billing_country string Country of the billing address.
billing_country_name string The name of the billing address country.
billing_post_code string The post or zip code of the billing address.
shipping_same_as_billing boolean Is the shipping address the same as the billing address?
instore_pickup boolean Has the order been requested to be picked up instore?
shipping_line1 string Line one of the shipping address.
shipping_line2 string Line two of the shipping address.
shipping_suburb string The town or suburb of the shipping address.
shipping_state string The state of the shipping address.
shipping_state_name string The name of the state of the shipping address.
shipping_state_other string Field for an alternative state or province name for the shipping address.
shipping_country string Country of the shipping address.
shipping_country_name string The name of the shipping address country.
shipping_post_code string The post or zip code of the shipping address.
telephone_number string The contact telephone number for the person responsible for this order.
grand_total string The grand total for the order.
grand_total_in_cents string The grand total in cents.
tax_total decimal The total amount of tax.
tax_total_in_cents integer The total amount of tax in cents.
shipping_and_handling decimal Shipping and handling fees.
freight decimal The cost of freight
discount decimal The amount of any discount if it was applied.
line_items json The list of line items in the order.
item_name string The name of the item ordered.
quantity integer The quantity ordered.
name_a string Name a of the selected variant.
name_b string Name b of the selected variant.
sku string The SKU code of the variant.
price decimal The unit price of the selected variant.
tax_exempt boolean Is the selected variant tax exempt?
unit_tax decimal The amount of tax per variant.
tax decimal The total amount of tax.
total decimal The total for the given quantity.

Examples

Below is a sample javascript function to call the payment service.

 1var request = $.ajax({
 2  type: "POST",
 3  url: "{{ '/__/pay/cart.json' | secure_url }}",
 4  data: {
 5    '_launch_ly_session': $('#session_id').val(),
 6    'reference': $('#cart_reference').val(),
 7    'first_name': $('#card_first_name').val(),
 8    'last_name': $('#card_last_name').val(),
 9    'card_number': $('#card_number').val(),
10    'payment_type': $('#payment_type').val(),
11    'expires_month': $('#card_expires_month').val(),
12    'expires_year': $('#card_expires_year').val(),
13    'card_verification': $('#card_verification').val()
14  }
15});

Here is a sample successful response …

 1{
 2  "domain": "localhost",
 3  "action": "Purchase",
 4  "amount": 23500,
 5  "success": true,
 6  "message": "Transaction Approved",
 7  "reference": "lpabuheu",
 8  "order": {
 9    "coupon_code": null,
10    "first_name": "Craig",
11    "last_name": "Sullivan",
12    "billing_line1": "Suite 19, 20 Enterprise Drive",
13    "billing_line2": null,
14    "billing_suburb": "Bundoora",
15    "billing_state": "VIC",
16    "billing_state_name": "Victoria",
17    "billing_state_other": null,
18    "billing_country": "AU",
19    "billing_country_name": "Australia",
20    "billing_post_code": "3083",
21    "shipping_same_as_billing": true,
22    "instore_pickup": null,
23    "shipping_line1": "Suite 19, 20 Enterprise Drive",
24    "shipping_line2": null,
25    "shipping_suburb": "Bundoora",
26    "shipping_state": "VIC",
27    "shipping_state_name": "Victoria",
28    "shipping_state_other": null,
29    "shipping_country": "AU",
30    "shipping_country_name": "Australia",
31    "shipping_post_code": "3083",
32    "telephone_number": "1234567890",
33    "grand_total": 235.0,
34    "grand_total_in_cents": 23500,
35    "tax_total": 21.36,
36    "tax_total_in_cents": 2136,
37    "shipping_and_handling": 111.0,
38    "freight": 111.0,
39    "discount": 0.0,
40    "line_items": [{
41      "item_name": "My Sample Item",
42      "quantity": 1,
43      "name_a": "Colour",
44      "name_b": "Red",
45      "sku": "ABCD1234",
46      "price": 124.0,
47      "tax_exempt": false,
48      "unit_tax": 11.26,
49      "tax": 11.26,
50      "total": 124.0
51    }]
52  }
53}