Skip to main content

Payment with Masterpass

This integration method is used to perform Masterpass client integration on the merchant's side and to receive Masterpass payments through Craftgate on the server side. This allows the merchant to benefit from the various value-added services offered by Craftgate.

Generating Masterpass Token

After the user completes card and installment selection, the token value to be used in the Masterpass payment process is obtained through this service. This token is used in the token field within the MFS.purchase method of the Masterpass client SDK.

POST/payment/v2/masterpass-payments/generate-token

Request Parameters

The parameters expected to be sent in the requests to generate a Masterpass token are listed under the table and subheadings below;

msisdn
string
required

Phone number of the customer

userId
string
required

Value used to associate the customer with the Masterpass account

binNumber
number
required

The first 6 or 8 digits of the selected card. Can be accessed from the Value1 field of the object associated with the selected card in the response of the Masterpass MFS.listCards method

forceThreeDS
boolean
required

Should be set to true if 3D secure authentication is requested for the transaction.

createPayment
conversationId
string

"boomerang" value that can be sent with the request and received with the response. It can be used to associate different requests with each other. Usually, the order number is used that is stored in merchant own system.
Special characters that may cause security problems should not be used in the data. Data cannot start with the + or - character, but it can be used in it.

externalId
string

It is generally used as a payment order number or basket number on the merchant side. You can search with this value later by using reporting services.
Special characters that may cause security problems should not be used in the data. Data cannot start with the + or - character, but it can be used in it.

price
decimal
required

Total basket price. The sum of the item prices in the basket must be equal to total basket price.

paidPrice
decimal
required

The final amount to be paid from the card by calculating differences such as commissions and discounts. The amount to be collected from the wallet is also included in this amount. If there is an interest in the transaction, the amount with the interest added should be entered in this parameter.

installment
number
required

Installment number. Should be 1 for cash price.

buyerMemberId
number

ID of the buyer that is returned from member creation.

currency
Currency
required
Values:
TRY
USD
EUR
GBP
CNY
ARS
BRL
AED
IQD
AZN
KZT
KWD
SAR
BHD
RUB
JPY
EGP
paymentGroup
PaymentGroup
Values:
PRODUCT
LISTING_OR_SUBSCRIPTION
paymentPhase
PaymentPhase
Values:
AUTH
PRE_AUTH
POST_AUTH
paymentChannel
string

It is generally used to keep information specific to the payment channel on the merchant side. You can search with this value later by using reporting services.

bankOrderId
string

Order id parameter to be transmitted to the bank when receiving the payment. Since it is optional, it is recommended not to send it and the orderId value is generated by Craftgate.

clientIp
string

IP of the buyer.

posAlias
string

Represents the POS that payment will be collected.

items
PaymentItem[]
required

Payment items related to payment. You must send at least one payment item and the sum of prices must be equal to the price field.

additionalParams
map<string, object>

Additional parameters related to payment. See: Payment Additional Parameters

loyalty
Loyalty

Reward information requested to be used during payment. See Using Rewards and Points

Response Parameters

The parameters returned as a result of generate token are also subject to the rules specified in the Response Formats section of the API documentation home page. In the absence of a systematic or fictional error, the sub-parameters of the object returned in the data parameter are as follows:

referenceId
string

Value used to complete the Masterpass payment process

token
string

Token value to be used within the Masterpass client SDK

orderNo
string

Value to be used in the MFS.purchase method. If request sent with the bankOrderId parameter, the sent value is returned. If the bankOrderId parameter is not sent, an automatically generated orderNo value is returned.

Non-3DS Masterpass Payment

If the responseCode value in the response that is return from MFS.purchase method is 5001, it indicates that the Masterpass payment process needs to be verified using the OTP method. After completing OTP verification on the client side through Masterpass integration, payment process can be completed by sending the obtained token value to Craftgate through the following service.

POST/payment/v2/masterpass-payments/complete

Request Parameters

The parameters expected to be sent in the requests to complete a Non-3DS Masterpass payment are listed under the table and subheadings below;

referenceId
string
required

Value returned in the generate token response for the relevant transaction.

token
string
required

Token value returned by Masterpass, used to complete the payment

Response Parameters

The parameters returned as a result of completing a Masterpass Non-3DS payment are also subject to the rules specified in the Response Formats section of the API documentation home page. In the absence of a systematic or fictional error, the sub-parameters of the object returned in the data parameter are as follows:

id
number

ID of the payment.

createdDate
date

The date that payment is created

price
decimal

Basket price of the payment

paidPrice
decimal

Paid price of the payment

walletPrice
decimal

Wallet price of the payment

currency
Currency
Values:
TRY
USD
EUR
GBP
CNY
ARS
BRL
AED
IQD
AZN
KZT
KWD
SAR
BHD
RUB
JPY
EGP
buyerMemberId
number

Buyer member ID of the payment

installment
number

Installment number

conversationId
string

Value of theconversationId parameter sent in the payment request

externalId
string

externalId value that sent in payment request by merchant

paymentType
PaymentType
Values:
CARD_PAYMENT
DEPOSIT_PAYMENT
WALLET_PAYMENT
CARD_AND_WALLET_PAYMENT
BANK_TRANSFER
APM
paymentGroup
PaymentGroup
Values:
PRODUCT
LISTING_OR_SUBSCRIPTION
paymentSource
PaymentSource
Values:
API
CHECKOUT_FORM
PAY_BY_LINK
paymentStatus
PaymentStatus
Values:
FAILURE
SUCCESS
INIT_THREEDS
CALLBACK_THREEDS
WAITING
paymentPhase
PaymentPhase
Values:
AUTH
PRE_AUTH
POST_AUTH
paymentChannel
string

paymentChannel value sent by the merchant in the payment request

isThreeDS
boolean

Indicates whether the payment is 3D Secure payment

merchantCommissionRate
decimal

Interest rate to calculate paid price that buyer will pay

merchantCommissionRateAmount
decimal

Interest amount. Equal to the difference between paidPrice and price values

bankCommissionRate
decimal

Bank commission rate

bankCommissionRateAmount
decimal

Bank commission rate amount

cardUserKey
string

Card user key that represents the card holder.

cardToken
string

Card token that represents the card.

paidWithStoredCard
boolean

Indicates whether the payment was made with a stored card

binNumber
string

Exist for the payments fully or partially collected from the card. First 8 digits of the card

lastFourDigits
string

Exist for the payments fully or partially collected from the card. Last 4 digits of the card

cardHolderName
string

Card holder name surname

bankCardHolderName
string

Card holder name surname retrieved from bank. The return value might be null for PF poses

authCode
string

authCode value retrieved from bank related to the payment. The return value might be null for PF poses

hostReference
string

hostReference value retrieved from bank related to the payment

transId
string

transId value retrieved from bank related to the payment. The return value might be null for PF poses

orderId
string

orderId value retrieved from bank related to the payment

cardType
CardType

(See: Card Types)

Values:
CREDIT_CARD
DEBIT_CARD
PREPAID_CARD
cardAssociation
CardAssociation

Card Association

Values:
VISA
MASTER_CARD
AMEX
TROY
JCB
UNION_PAY
MAESTRO
DISCOVER
DINERS_CLUB
cardBrand
string

Brand of card. Exist for the payments fully or partially collected from the card

requestedPosAlias
string

Value of theposAlias parameter sent in the payment request

pos
MerchantPos

POS info that payment is received

loyalty
Loyalty

Loyalty info that used in payment (See: Reward Usage)

fraudId
number

Fraud Check Id if fraud rule matches (See: Fraud Checks)

fraudAction
FraudAction

Fraud Check Action if fraud rule matches (See: Fraud Actions)

Values:
BLOCK
REVIEW
paymentTransactions
PaymentTransaction[]

It includes the transaction information sent when making the payment request, and the pricing and money transfer information of the payment based on these transactions

additionalData
map<string, map>

Additional data related to the payment

3D Secure Masterpass Payment

If the responseCode value in the response that is returned from MFS.purchase method is 5010, it indicates that the Masterpass payment process needs to be verified using the 3D Secure. Below are the relevant steps for processing 3D Secure payment flow.

Init 3D Secure Payment

POST/payment/v2/masterpass-payments/3ds-init

Request Parameters

The parameters expected to be sent in the requests to init Masterpass 3DS payment are listed under the table and subheadings below;

referenceId
string
required

Value returned in the generate token response for the relevant transaction.

callbackUrl
string
required

The URL to be used to send the result returned from the bank to the merchant

Response Parameters

The parameters returned as a result of initiating a Masterpass 3DS payment are also subject to the rules specified in the Response Formats section of the API documentation home page. In the absence of a systematic or fictional error, the sub-parameters of the object returned in the data parameter are as follows:

paymentId
number

ID of payment. For mobile flow this value should be used in the 3DS complete step.

returnUrl
string

For web flow, URL to which the user will be redirected by appending the url3D field obtained from the MFS.purchase method response
For mobile flow, URL which should be given to the resultUrl3D field before calling validateTransaction3D.

Web
   window.location = `${purchaseResult.url3D}&returnUrl=${returnUrl}`;
Mobile
   MasterPassInfo.setResultUrl3D(returnUrl);;

Verify 3D Secure Payment

Once the user has verified themselves, they will be redirected to the callbackUrl address specified in the 3D Secure Payment Init request. For details, see 3D Secure Verification.

There will be no redirection for mobile flow, you should call the 3DS complete service after receiving the validateTransaction3D callback response.

Complete 3D Secure Payment

After completing the relevant checks in the previous step, the 3D Secure payment process can be completed using the following service.

POST/payment/v2/masterpass-payments/3ds-complete

Request Parameters

The parameters expected to be sent in the requests to complete Masterpass 3DS payment are listed under the table and subheadings below;

paymentId
number
required

PaymentId value obtained from the 3D Secure Verification step.

Response Parameters

The parameters returned as a result of completing a Masterpass 3D Secure payment are also subject to the rules specified in the Response Formats section of the API documentation home page. In the absence of a systematic or fictional error, the sub-parameters of the object returned in the data parameter are as follows:

id
number

ID of the payment.

createdDate
date

The date that payment is created

price
decimal

Basket price of the payment

paidPrice
decimal

Paid price of the payment

walletPrice
decimal

Wallet price of the payment

currency
Currency
Values:
TRY
USD
EUR
GBP
CNY
ARS
BRL
AED
IQD
AZN
KZT
KWD
SAR
BHD
RUB
JPY
EGP
buyerMemberId
number

Buyer member ID of the payment

installment
number

Installment number

conversationId
string

Value of theconversationId parameter sent in the payment request

externalId
string

externalId value that sent in payment request by merchant

paymentType
PaymentType
Values:
CARD_PAYMENT
DEPOSIT_PAYMENT
WALLET_PAYMENT
CARD_AND_WALLET_PAYMENT
BANK_TRANSFER
APM
paymentGroup
PaymentGroup
Values:
PRODUCT
LISTING_OR_SUBSCRIPTION
paymentSource
PaymentSource
Values:
API
CHECKOUT_FORM
PAY_BY_LINK
paymentStatus
PaymentStatus
Values:
FAILURE
SUCCESS
INIT_THREEDS
CALLBACK_THREEDS
WAITING
paymentPhase
PaymentPhase
Values:
AUTH
PRE_AUTH
POST_AUTH
paymentChannel
string

paymentChannel value sent by the merchant in the payment request

isThreeDS
boolean

Indicates whether the payment is 3D Secure payment

merchantCommissionRate
decimal

Interest rate to calculate paid price that buyer will pay

merchantCommissionRateAmount
decimal

Interest amount. Equal to the difference between paidPrice and price values

bankCommissionRate
decimal

Bank commission rate

bankCommissionRateAmount
decimal

Bank commission rate amount

cardUserKey
string

Card user key that represents the card holder.

cardToken
string

Card token that represents the card.

paidWithStoredCard
boolean

Indicates whether the payment was made with a stored card

binNumber
string

Exist for the payments fully or partially collected from the card. First 8 digits of the card

lastFourDigits
string

Exist for the payments fully or partially collected from the card. Last 4 digits of the card

cardHolderName
string

Card holder name surname

bankCardHolderName
string

Card holder name surname retrieved from bank. The return value might be null for PF poses

authCode
string

authCode value retrieved from bank related to the payment. The return value might be null for PF poses

hostReference
string

hostReference value retrieved from bank related to the payment

transId
string

transId value retrieved from bank related to the payment. The return value might be null for PF poses

orderId
string

orderId value retrieved from bank related to the payment

cardType
CardType

(See: Card Types)

Values:
CREDIT_CARD
DEBIT_CARD
PREPAID_CARD
cardAssociation
CardAssociation

Card Association

Values:
VISA
MASTER_CARD
AMEX
TROY
JCB
UNION_PAY
MAESTRO
DISCOVER
DINERS_CLUB
cardBrand
string

Brand of card. Exist for the payments fully or partially collected from the card

requestedPosAlias
string

Value of theposAlias parameter sent in the payment request

pos
MerchantPos

POS info that payment is received

loyalty
Loyalty

Loyalty info that used in payment (See: Reward Usage)

fraudId
number

Fraud Check Id if fraud rule matches (See: Fraud Checks)

fraudAction
FraudAction

Fraud Check Action if fraud rule matches (See: Fraud Actions)

Values:
BLOCK
REVIEW
paymentTransactions
PaymentTransaction[]

It includes the transaction information sent when making the payment request, and the pricing and money transfer information of the payment based on these transactions

additionalData
map<string, map>

Additional data related to the payment