⚬ Workflow
⚬ Create a Checkout
curl -v -H 'Accept: application/json; indent=4' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <temporary-bearer-token>' \
-X POST -d '{
"reference": "198776653",
"display_reference": "198776653",
"description": "Order #198776653",
"total": "300.00",
"currency": "QAR",
"confirm_callback_url": "https://mywebsite.com/?success",
"reject_callback_url": "https://mywebsite.com/?failed",
"order": {
"tax_amount": null,
"shipping_amount": null,
"discount": null,
"customer": {
"first_name": "George",
"last_name": "Clooney",
"email": "g.clooney@example.com",
"phone": "+974559993322"
},
"billing_address": {
"title": "Mr",
"first_name": "George",
"last_name": "Clooney",
"line1": "My House 12",
"line2": "",
"line3": "",
"line4": "Dubai",
"state": "",
"postcode": "4400",
"country": "QA",
"phone": "+974559993322"
},
"shipping_address": {
"title": "Mr",
"first_name": "George",
"last_name": "Clooney",
"line1": "My House 12",
"line2": "",
"line3": "",
"line4": "Dubai",
"state": "",
"postcode": "4400",
"country": "QA",
"phone": "+974559993322"
},
"lines": [
{
"sku": "sku-1",
"reference": "reference-1",
"title": "Livingston All-Purpose Tight",
"upc": "upc-1",
"quantity": 1,
"price": "300.00",
"currency": "QAR",
"image_url": "http://mywebsite.com/products/mh07-gray_main_2.jpg"
}
]
}
}' https://api.sandbox.nymcard.com/api/v1.0/checkouts/
shell
The above command returns JSON structured like this:
{
"reference" : "198776653" ,
"display_reference" : "198776653" ,
"description" : "Order #198776653" ,
"total" : "300.00" ,
"currency" : "QAR" ,
"confirm_callback_url" : "https://mywebsite.com/?success" ,
"reject_callback_url" : "https://mywebsite.com/?failed" ,
"order" : {
"tax_amount" : null ,
"shipping_amount" : null ,
"discount" : null ,
"customer" : {
"first_name" : "George" ,
"last_name" : "Clooney" ,
"email" : "g.clooney@example.com" ,
"phone" : "+974559993322"
},
"billing_address" : {
"title" : "Mr" ,
"first_name" : "George" ,
"last_name" : "Clooney" ,
"line1" : "My House 12" ,
"line2" : "" ,
"line3" : "" ,
"line4" : "Dubai" ,
"state" : "" ,
"postcode" : "4400" ,
"country" : "QA" ,
"phone" : "+974559993322"
},
"shipping_address" : {
"title" : "Mr" ,
"first_name" : "George" ,
"last_name" : "Clooney" ,
"line1" : "My House 12" ,
"line2" : "" ,
"line3" : "" ,
"line4" : "Dubai" ,
"state" : "" ,
"postcode" : "4400" ,
"country" : "QA" ,
"phone" : "+974559993322"
},
"lines" : [
{
"line_id" : "b05508f7-825f-413a-8fa6-ce6fff24315d" ,
"sku" : "sku-1" ,
"reference" : "reference-1" ,
"notes" : null ,
"title" : "Livingston All-Purpose Tight" ,
"upc" : "upc-1" ,
"quantity" : 1 ,
"price" : "300.00" ,
"currency" : "QAR" ,
"image_url" : "http://mywebsite.com/products/mh07-gray_main_2.jpg"
}
]
},
"checkout_url" : "https://sandbox.nymcard.com/checkout/?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1ODE5MzQ5NDAsImNoZWNrb3V0X2lkIjoiYmM2ODg5ZDctZDc5Mi00MDAyLWE4OGQtOTgwZjJjNzg0Mjk1In0.K-U4pRnfaNZ4aCKR-OFy9zVrIywhBaNlCOTAZEmzaLE"
}
json
This endpoint creates a merchant checkout. Upon a successful request, a checkout_url link will be provided for the merchant's customer to process payment at Nymcard's payment portal. If payment is successful, the customer will be redirected to the provided confirm_callback_url link. Else if payment is rejected, the customer will be redirected to the provided reject_callback_url link.
HTTP Request
POST https://api.sandbox.nymcard.com/api/v1.0/checkouts/
Query Parameters
Order
{
"tax_amount" : null ,
"shipping_amount" : null ,
"discount" : null ,
"customer" : {},
"billing_address" : {},
"shipping_address" : {},
"lines" : []
}
json
Customer
{
"first_name" : "George" ,
"last_name" : "Clooney" ,
"email" : "g.clooney@example.com" ,
"phone" : "+974559993322"
}
json
Billing
{
"title" : "Mr" ,
"first_name" : "George" ,
"last_name" : "Clooney" ,
"line1" : "My House 12" ,
"line2" : "" ,
"line3" : "" ,
"line4" : "Dubai" ,
"state" : "" ,
"postcode" : "4400" ,
"country" : "QA" ,
"phone" : "+974559993322"
}
json
Shipping
{
"title" : "Mr" ,
"first_name" : "George" ,
"last_name" : "Clooney" ,
"line1" : "My House 12" ,
"line2" : "" ,
"line3" : "" ,
"line4" : "Dubai" ,
"state" : "" ,
"postcode" : "4400" ,
"country" : "QA" ,
"phone" : "+974559993322"
}
json
Lines
{
"sku" : "sku-1" ,
"reference" : "reference-1" ,
"title" : "Livingston All-Purpose Tight" ,
"upc" : "upc-1" ,
"quantity" : 1 ,
"price" : "300.00" ,
"currency" : "QAR" ,
"image_url" : "http://mywebsite.com/products/mh07-gray_main_2.jpg"
}
json