Checkout
When the customer selects COMPLETE ORDER with YOUR PAY as the selected payment, you need to send a request to our API with the following data for generating a token-based redirect URI.
The checkout model
The checkout model contains all the information about your checkout requests, such as their orderid, billing and customer info etc. It also contains the cart information for further processing.
Properties
- Name
type
- Type
- string
- Description
The type of transaction (i.e. sale)
- Name
orderid
- Type
- string
- Description
The unique id of the order
- Name
invoice
- Type
- string
- Description
The merchant's invoice number of the order
- Name
email
- Type
- string
- Description
The user's email address
- Name
billing
- Type
- object
- Description
The user's billing address
- Name
shipping
- Type
- object
- Description
The user's shipping address
- Name
currency
- Type
- string
- Description
The merchant's configured currency (USD only)
- Name
amounttotal
- Type
- number
- Description
The total amount of the order (in cents)
- Name
taxtotal
- Type
- number
- Description
The total tax amount calculated on the order (in cents)
- Name
shippingtotal
- Type
- number
- Description
The total shipping amount calculated on the order (in cents)
- Name
discount
- Type
- number
- Description
The total discount amount calculated on the order (in cents)
- Name
items
- Type
- array
- Description
A collection of the items purchased
- Name
cancelurl
- Type
- string
- Description
The URL to redirect the user if they cancel the checkout sequence
- Name
errorurl
- Type
- string
- Description
The URL to redirect the user if there is an error while processing.
- Name
callbackurl
- Type
- string
- Description
The URL Tandym will callback to signal completion of the payment processing and will include the status (Approved or declined)
- Name
redirecturl
- Type
- string
- Description
We will redirect the customer to this URL upon Payment confirmation (typically your order confirmation page)
- Name
testMode
- Type
- boolean
- Description
Should be sent as true to check the app with staging credentials.
Create a checkout
This endpoint allows you initiate a checkout request to get the redirect URL for further processing.
Required attributes
- Name
type
- Type
- string
- Description
The type of transaction (i.e. sale)
- Name
orderid
- Type
- string
- Description
The unique id of the order
- Name
invoice
- Type
- string
- Description
The merchant's invoice number of the order
- Name
email
- Type
- string
- Description
The user's email address
- Name
billing
- Type
- object
- Description
The user's billing address
- Name
shipping
- Type
- object
- Description
The user's shipping address
- Name
currency
- Type
- string
- Description
The merchant's configured currency (USD only)
- Name
amounttotal
- Type
- number
- Description
The total amount of the order (in cents)
- Name
taxtotal
- Type
- number
- Description
The total tax amount calculated on the order (in cents)
- Name
shippingtotal
- Type
- number
- Description
The total shipping amount calculated on the order (in cents)
- Name
discount
- Type
- number
- Description
The total discount amount calculated on the order (in cents)
- Name
items
- Type
- array
- Description
A collection of the items purchased
- Name
cancelurl
- Type
- string
- Description
The URL to redirect the user if they cancel the checkout sequence
- Name
errorurl
- Type
- string
- Description
The URL to redirect the user if there is an error while processing.
- Name
callbackurl
- Type
- string
- Description
The URL Tandym will callback to signal completion of the payment processing and will include the status (Approved or declined)
- Name
redirecturl
- Type
- string
- Description
We will redirect the customer to this URL upon Payment confirmation (typically your order confirmation page)
- Name
testMode
- Type
- boolean
- Description
Should be sent as true to check the app with staging credentials.
Request
curl -X POST https://stagingapi.platform.poweredbytandym.com/custom/checkout \
-H 'content-type:application/json' \
-H 'apiKey:{YOURPAY_API_KEY}' \
-d '{
"type":"sale”,
"orderid":555,
"invoice":"HT-555",
"email":"customer@test.com",
"billing":{
"firstname":"Andrew",
"lastname":"Brown",
"company":"NA",
"address":"506 Ramseur Street",
"address2":"4",
"city":"Durham",
"state":"NC",
"zip":"27701",
"country":"US",
"phone":"123123
},
"shipping":{
"firstname":"Andrew",
"lastname":"Brown",
"company":"NA",
"address":"506 Ramseur Street",
"address2":"4",
"city":"Durham",
"state":"NC",
"zip":"27701",
"country":"US",
"phone":"1231231212"
},
"currency":"USD",
"amounttotal":55199,
"taxtotal":1000,
"shippingtotal":500,
"discount":1000,
"items":[
{
"itemid":"2484065QCS",
"itemname":"Your Best Seller",
"itemimageurl":"https://www.yoursite.com/files/bestsellers/2484065kcs.jpg",
"unitprice":28799,
"quantity":1
},
{
"itemid":"LA-2100-IG-20",
"itemname":"Your Best Seller",
"itemimageurl":"https://www.yoursite.com/files/bestsellers/2484065kcs.jpg",
"unitprice":26400,
"quantity":1
}
],
"cancelurl":"https://www.yoursite.com/cart",
"errorurl":"https://www.yoursite.com/cart?error=0",
"callbackurl":"https://www.yoursite.com/callback",
"redirecturl":"https://www.yoursite.com/redirect?status=success",
"testMode":true
}'
Success Response
{
"redirecturl": "https://yoursite.pay.poweredbytandym.com?paymenttoken=63496dd12b4c537984c6ea39",
}
Error Response
{
"errorMsg": "Invalid credentials! Try again with the proper credentials!"
}