Finalise Masterpass REST Order
Finalises the Masterpass REST order. The body of this request reflects the Masterpass / 3D Secure callback payload. Note that all query string parameters from the request URL are merged into the submitted form data, while the amount form key (if any) is removed before validation. This is the mechanism used to consume 3D Secure return parameters that are appended as query string by the gateway.
Required Fields:
three_d_secure: Must matchpre_order.redirect_to_three_d(set duringMasterpassRestOrderNoPage). Submitting a mismatching value returns the error"Transaction failed. Please try again.".
Optional / 3D Secure Callback Fields:
token: Masterpass payment token.oid,md,xid,eci,cavv,rnd,hash,hashParams,hashParamsVal,mdStatus,bankIca,paymentReceived,clientId,sign: 3D Secure callback parameters returned by the bank.amount: Decimal value (12 digits, 2 decimal places). When provided, it is divided by 100 and validated againstpre_order.get_total_amount_with_interest(). A mismatch returns"Transaction failed. Please try again.". Note that theamountform key in the body is stripped before merging the query string, so the value used is the one provided via the bank callback if any.transactionType: One ofPURCHASE,PURCHASE_3D,DIRECT_PURCHASE,DIRECT_PURCHASE_3D,REGISTER_AND_PURCHASE,REGISTER_AND_PURCHASE_3D.status,completeStatus,paymentId,conversationData,conversationId,callbackStatus: Additional Masterpass status fields.
3D Secure Validation:
When
three_d_secureistrue:If the gateway has
hash_validation_enabledand the request comes from a non-mobile client (client_typeis neitheriosnorandroid), the hash is validated viagateway.is_hash_valid(...). A failure returns"Hash values don't match.".The MD status is validated via
gateway.is_md_status_valid(...). A failure returns"Transaction failed. Please try again.".
Processing:
The base
process()is called with the merged data (form body + request query string, with the formamountremoved).The
set_defaultsstep runs withset_number=Falsebecause the order number was already assigned inMasterpassRestOrderNoPage.When
pre_order.redirect_to_three_disfalse,skip_create_transactionreturnstrueand no separate transaction record is created at this step. Otherwise a transaction with id"MASTERPASS_<order_number>_<suffix>"is created.The Masterpass payment is processed via the
PaymentPageMixin.process_orderflow, which submits the basket, saves contracts, and triggers post-completion notifications.
Next Pages:
ThankYouPage
Backward Navigation:
This page does not perform any backward state changes (
backward()is a no-op).
available_for_post_order: true
Required header for AJAX requests. Must be set to XMLHttpRequest for all checkout requests.
XMLHttpRequestPossible values: Session cookie header (e.g. sessionid=abc123 or osessionid=<session_id>)
Final Masterpass REST submission payload. The endpoint also merges any
request query string parameters into the form data (with the form
amount key removed before merging) so that 3D Secure callback
parameters appended by the bank are captured automatically.
Must match pre_order.redirect_to_three_d set in
MasterpassRestOrderNoPage. A mismatch returns
"Transaction failed. Please try again.".
trueMasterpass payment token issued by the SDK.
mp-token-abc123Order id echoed back by the bank on 3D callback.
ORD-2026-00423D Secure md parameter from the bank callback.
3D Secure xid parameter from the bank callback.
3D Secure ECI value from the bank callback.
053D Secure CAVV value from the bank callback.
3D Secure random nonce from the bank callback.
Bank-issued response hash. Validated via gateway.is_hash_valid when
three_d_secure is true and the gateway has
hash_validation_enabled (skipped for iOS/Android client types).
3D Secure hash params list from the bank callback.
3D Secure hash params values from the bank callback.
3D Secure MD status. Validated via gateway.is_md_status_valid
when three_d_secure is true. A failure returns
"Transaction failed. Please try again.".
1Bank ACQ ICA value passed back by the gateway.
Payment received indicator returned by the gateway.
Total amount in minor units returned by the bank. Divided by 100
during validation and compared against
pre_order.get_total_amount_with_interest(). A mismatch returns
"Transaction failed. Please try again.". Note: any amount form
field is dropped before request query parameters are merged into
the body, so the value used is the one supplied by the bank
callback when present.
16559Merchant client id echoed back by the gateway.
Signature value from the bank callback.
Masterpass transaction type.
PURCHASE_3DPossible values: Masterpass status string.
Masterpass complete status string.
Masterpass payment id.
Masterpass conversation data.
Masterpass conversation id.
Masterpass callback status string.
Masterpass REST order finalised successfully
POST /orders/checkout/?page=MasterpassRestCompletePage HTTP/1.1
Host: sandbox.akinon.com
x-requested-with: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 50
"three_d_secure=false&token='mp-token-abc123'"Masterpass REST order finalised successfully
{
"context_list": [
{
"page_name": "ThankYouPage",
"page_slug": "thankyoupage",
"page_context": {
"redirect_url": "/orders/checkout-success/abc123:def456:ghi789/",
"order_id": 5042,
"order_number": "ORD-2026-0042",
"new_user": false,
"token": null,
"campaigns": []
}
}
],
"pre_order": {
"order": {
"pk": 5042,
"number": "ORD-2026-0042",
"status": "confirmed"
},
"payment_option": {
"pk": 7,
"slug": "masterpass-rest",
"payment_type": "masterpass_rest"
},
"number": "ORD-2026-0042",
"total_amount": "165.59",
"currency_type_label": "TRY"
},
"errors": {},
"template_name": "orders/checkout.html"
}Last updated
Was this helpful?

