Masterpass Rest Payment Option
Omnitron Settings
Payment Options
One payment option must be defined in Omnitron to be specific for the extension installed. Explanations on how the settings should be made at this stage are in the table below.
Payment Option
Masterpass Rest
Payment Option Name
Masterpass Rest
Payment Option Slug
mp_rest
Config
{ “pos_slug”: “mp_rest”, "provision_enabled": true/false }
Token Services and Init Payments
Masterpass Rest Token
This method is used to get Masterpass Bearer Token. It should be used after PaymentOptionSelectionPage. If three_d is false or isn’t provided, pos’es “Three d enabled” value will be used.
GET
https://{{commerce_url}}/orders/masterpass-rest-token?three_d=true|false&msisdn_validated=true|false
Example Response
{
"msisdn": "...",
"token": "Bearer...",
"extras": {
"bank_ica": null
}
}
Masterpass via Craftgate Rest Token
This method is used to get Masterpass Bearer Token from Craftgate. It should be used after PaymentOptionSelectionPage to list saved cards. It uses 123456 for bin_number and 1 for installment_count*.* After MasterpassRestOrderNoPage, it uses customers bin_number and installment_count. So, the token must be requested again.
Example request flow:
PaymentOptionSelectionPage
Get token from Craftgate
MasterpassRestBinNumberPage
MasterpassRestInstallmentPage
MasterpassRestOrderNoPage
Get token from Craftgate again
MasterpassRestCompletePage
GET
https://{{commerce_url}}/orders/craftgate-masterpass-token?three_d=true|false
Example Response
{
"msisdn": "...",
"token": "Bearer...",
"referenceId": "...",
"orderNo": "...",
"extras": {
"bank_ica": null
}
}
Masterpass via Craftgate 3D Init
Also, if the payment is 3D, init service must be called before the payment. You can get more details from Craftgate
GET
https://{{commerce_url}}/orders/craftgate-masterpass-init?reference_id=...
Example Response
{
"paymentId": ...,
"returnUrl": "https://...",
}
Pages
Start Masterpass Rest Payment Type
This method is used to start Masterpass Rest Payment Type.
POST
https://{{commerce_url}}/orders/checkout/?page=MasterpassRestBinNumberPage
Example Request
{
"is_masterpass_stored_card": true,
"bin_number": "665544"
}
Example Response
{
"context_list": [
{
"page_context": {
"installments": [
{
"pk": 1,
"installment_count": 1,
"label": "Advance",
"price_with_accrued_interest": 100,
"monthly_price_with_accrued_interest": 100
},
{
"pk": 2,
"installment_count": 3,
"label": "3 Installments",
"price_with_accrued_interest": 105,
"monthly_price_with_accrued_interest": 105
}
],
"card_type": {
"name": "Card Finans",
"slug": "card-finans",
"logo": "https://cdn-mgsm.akinon.net/card_types/2017/01/25/56dd552c-c769-4b3f-86f6-1f340bafa3c0.jpg"
},
"installment_messages": []
},
"page_name": "MasterpassRestInstallmentPage",
"page_slug": "masterpassrestinstallmentpage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {}
}
Set Installment on Masterpass Rest Payment Type
This method is used to set installment option on Masterpass Rest Payment Type.
POST
https://{{commerce_url}}/orders/checkout/?page=MasterpassRestInstallmentPage
Example Request
{
"installment": 1
}
Example Response
{
"context_list": [
{
"page_context": {},
"page_name": "MasterpassRestOrderNoPage",
"page_slug": "masterpassrestordernopage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
Continue on Masterpass Rest Payment Type
This method is used to continue on Masterpass Rest Payment Type.
POST
https://{{commerce_url}}/orders/checkout/?page=MasterpassRestOrderNoPage
Example Request
{
"use_three_d": true
}
Example Response
{
"context_list": [
{
"page_context": {
"msisdn": "...",
"order_no": "...",
"three_d": true,
"extras": {...},
},
"page_name": "MasterpassRestCompletePage",
"page_slug": "masterpassrestcompletepage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
Continue on Masterpass Rest Payment Type
This method is used to continue on Masterpass Rest Payment Type.
transactionType values:
DIRECT_PURCHASE
DIRECT_PURCHASE_3D
PURCHASE
PURCHASE_3D
REGISTER_AND_PURCHASE
REGISTER_AND_PURCHASE_3D
POST https://{{commerce_url}}/orders/checkout/?page=MasterpassRestCompletePage&responseCode={{responseCode}}&token={{token}}&three_d_secure={{true/false}}
Example Request for Masterpass POS
{
"token": "...",
"transactionType": "...",
...
}
Example Request for Craftgate POS
{
"token": "...", // Non-3D
"referenceId": "...", // Non-3D
"paymentId": "...", // 3D
...
}
Example Response
{
"context_list": [
{
"page_context": {
"redirect_url": "/orders/completed/IjcwMjExMjMyMTA5MTci:1mRByT:tTgDsJbIKXyxJZyIZwHIBqtShvw/",
"order_id": 303,
"new_user": false,
"token": "138ddd19a0436166354cccbacb4cbb0473104193",
"campaigns": []
},
"page_name": "ThankYouPage",
"page_slug": "thankyoupage"
}
],
"template_name": "orders/checkout.html",
"errors": null,
"pre_order": {...}
}
Additional Notes
Last updated
Was this helpful?