29 NEXT
Search…
3DS2 Admin API Guide
Support 3DS2 transactions for custom-designed checkouts over the Admin API
3DS2 payments are fully supported via the Admin API to process the customer through an authentication flow, with the final transaction information and results provided back to your application.
Important - Your store must have a 3DS2 enabled gateway to process 3DS2 transactions.

Step 1 - Create Order on Admin API with Bankcard as Payment Method

When creating a new order using a 3DS2 enabled gateway, you’ll need to use the payment_method=bankcard as well as provide a payment_return_url. The payment_return_url is your endpoint that will receive a POST request containing the final transaction data (in Step 3).
"payment_method": "bankcard",
"payment_details": {
"card_name": "Test name",
"card_number": "5555555555554444",
"card_cvv": 123,
"card_expiry_month": 10,
"card_expiry_year": 2022,
"save_card": true,
"payment_return_url": "<YOUR APPLICATION ENDPOINT>"
}

Step 2 - Redirect Customer to the Payment Complete URL

The response from Step 1 will provide a payment_complete_url. Your application should redirect the customer to this URL for completing the payment authentication.
{
"reference_transaction_id": null,
"payment_complete_url": "https://<Your Store Domain>/payments/3ds-auth/?token=<Unique Transaction Token>"
}

Step 3 - Receive Order Data

After the customer has completed the checkout via the 3DS2 authentication page, they will be redirected to your application with a POST request containing data in the response key comprising all of the order information as a string. See examples below. Example parsing the data
""""
Order json data is stored in a variable called response.
If the order data is an empty dictionary {}, it means
payment collection was unsuccessful and order was not created.
"""
import json
def my_view(request):
data = json.loads(request.POST.get("response"))
...
return HttpResponse(status=201)
Example Order data
{
"number": "109405",
"status": "Confirmed",
"lines": [
{
"product": {
"id": 22,
"categories": [
],
"product_class": null,
"images": [
{
"id": 27,
"original": "https://d36qje162qkq4w.cloudfront.net/media/images/products/2020/02/hydro-cream.png",
"caption": "",
"display_order": 0,
"date_created": "2019-05-14T12:56:24.991823+07:00"
}
],
"title": "Skin Care Cream",
"upc": ""
},
"stockrecord": {
"id": 23,
"partner_sku": "TESTSKU233",
"price_currency": "USD",
"points_price": null,
"price_excl_tax": "56.00",
"price_retail": "89.00",
"cost_price": "10.00",
"num_in_stock": 1000,
"low_stock_threshold": 100
},
"quantity": 1,
"price_currency": "USD",
"price_excl_tax": "19.99",
"price_incl_tax": "19.99",
"price_incl_tax_excl_discounts": "19.99",
"price_excl_tax_excl_discounts": "19.99"
}
],
"shipping_incl_tax": "5.00",
"shipping_method": "Default shipping",
"shipping_code": "default-shipping",
"total_incl_tax": "69.99",
"currency": "USD",
"total_excl_tax": "69.99",
"shipping_excl_tax": "5.00",
"user": {
"id": 577,
"email": "[email protected]",
"first_name": "John",
"last_name": "Smith",
"phone_number": null
},
"shipping_address": {
"id": 9658,
"country": "US",
"title": "",
"first_name": "John",
"last_name": "Smith",
"line1": "2200 Testing Lane",
"line2": "PO Box 404",
"line3": "",
"line4": "Hoptown",
"postcode": "33635",
"phone_number": "+1937567889",
"notes": "",
"state": "FL"
},
"billing_address": null,
"date_placed": "2020-10-01T16:00:25.238490+07:00",
"payment_sources": [
{
"source_type": {
"name": "Prime Payments",
"code": "prime-payments"
}
}
],
"offer_discounts": [
],
"voucher_discounts": [
],
"attribution": null,
"tags": [
],
"subscriptions": [
],
"metadata": {
},
"transactions": [
{
"partner_transaction_id": "<Unique Transaction ID>",
"txn_type": "Debit",
"currency": "USD",
"amount": "69.99"
}
]
}