Create Payment Page Session

Request to create a session identifier for the hosted payment. The session identifier when included in the payment page request allows you to return the payer to the merchant's website after completing the payment attempt.

URL https://ap-gateway.mastercard.com/api/rest/version/19/merchant/{merchantId}/session
HTTP Method POST
Authentication This operation requires authentication via one of the following methods:
  • Certificate authentication.
  • Basic HTTP authentication as described at w3.org. Provide 'merchant.<your gateway merchant ID>' in the userid portion and your API password in the password portion.

Request Parameters

apiOperation  String =CREATE_PAYMENT_PAGE_SESSION FIXED

Existence
FIXED
Fixed value
CREATE_PAYMENT_PAGE_SESSION
Validation Rules
Any sequence of zero or more unicode characters.
XSD type
string

order   = COMPULSORY

Information about the order associated with this transaction.
Fixed value

order.amount  Decimal = COMPULSORY

If you provide both this value and any of the sub-total amounts (order.itemAmount, order.shippingAndHandlingAmount, order.taxAmount) then the sum of the sub-total amounts MUST equal the order.amount.
Existence
COMPULSORY
Fixed value
Validation Rules
Data is a string that consists of the characters 0-9 and '.' and represents a valid decimal number.
JSON type
String
minimum length
1
maximum length
14

order.currency  Upper case alphabetic text = COMPULSORY

Existence
COMPULSORY
Fixed value
Validation Rules
Data must consist of the characters A-Z
JSON type
String
minimum length
3
maximum length
3

order.id  String = COMPULSORY

Use this identifier when referring to this order in subsequent transactions and in retrieval operations. This value must be unique for every order you create using your merchant profile.
Existence
COMPULSORY
Fixed value
Validation Rules
Data can consist of any characters
JSON type
String
minimum length
1
maximum length
40

action   = OPTIONAL

Specify actions if you wish to change the default behaviour of the transaction.
Fixed value

action.bypassMerchantRiskRules  Enumeration = OPTIONAL

Existence
OPTIONAL
Fixed value
Validation Rules
JSON type
String
Value must be a member of the following list. The values are case sensitive.
ALL

apiOperation  String =CREATE_PAYMENT_PAGE_SESSION FIXED

Existence
FIXED
Fixed value
CREATE_PAYMENT_PAGE_SESSION
Validation Rules
Any sequence of zero or more unicode characters.
XSD type
string

constraints   = OPTIONAL

Specify constraints to ensure the transaction conforms to pre-defined criteria. This is useful when your integration does not directly collect all the transaction values. For example - a session based integration or hosted payment page integration.
Fixed value

constraints.paymentPlans   = OPTIONAL

Specify payment plan constraints to restrict the available payment plan options for this transaction.
Fixed value

constraints.paymentPlans.numberOfDeferrals  Integer = OPTIONAL

Existence
OPTIONAL
Fixed value
Validation Rules
JSON number data type, restricted to being positive or zero. In addition, the represented number may have no fractional part.
JSON type
Number
minimum value
0
maximum value
99

constraints.paymentPlans.numberOfPayments  Integer = OPTIONAL

Existence
OPTIONAL
Fixed value
Validation Rules
JSON number data type, restricted to being positive or zero. In addition, the represented number may have no fractional part.
JSON type
Number
minimum value
1
maximum value
99

constraints.paymentPlans.supported[n]  String = OPTIONAL

If you wish to offer any payment plans to the payer, provide the plan identifiers in this field else pass it as empty.

See Payment Plans for the supported payment plans and their identifiers.
Existence
OPTIONAL
Fixed value
Validation Rules
Data can consist of any characters
JSON type
String
minimum length
1
maximum length
40

correlationId  String = OPTIONAL

The value provided is not validated, does not persist in the gateway, and is returned as provided in the response to the request.
Existence
OPTIONAL
Fixed value
Validation Rules
Data can consist of any characters
XSD type
string
minimum length
1
maximum length
100

order   = COMPULSORY

Information about the order associated with this transaction.
Fixed value

order.amount  Decimal = COMPULSORY

If you provide both this value and any of the sub-total amounts (order.itemAmount, order.shippingAndHandlingAmount, order.taxAmount) then the sum of the sub-total amounts MUST equal the order.amount.
Existence
COMPULSORY
Fixed value
Validation Rules
Data is a string that consists of the characters 0-9 and '.' and represents a valid decimal number.
JSON type
String
minimum length
1
maximum length
14

order.currency  Upper case alphabetic text = COMPULSORY

Existence
COMPULSORY
Fixed value
Validation Rules
Data must consist of the characters A-Z
JSON type
String
minimum length
3
maximum length
3

order.id  String = COMPULSORY

Use this identifier when referring to this order in subsequent transactions and in retrieval operations. This value must be unique for every order you create using your merchant profile.
Existence
COMPULSORY
Fixed value
Validation Rules
Data can consist of any characters
JSON type
String
minimum length
1
maximum length
40

paymentPage   = OPTIONAL

Container for fields that control the payer's interaction on the payment page.
Fixed value

paymentPage.action.bypass3DSecure  Boolean = OPTIONAL

By default, the payer is prompted to authenticate before performing the payment if configured for the 3-D Secure Service.
Existence
OPTIONAL
Fixed value
Validation Rules
JSON boolean values 'true' or 'false'.
JSON type
Boolean

paymentPage.cancelUrl  URI = OPTIONAL

This could be a link to the payer's shopping cart, or the home page of your website.
Existence
OPTIONAL
Fixed value
Validation Rules
Data must be an absolute URI conforming to the URI syntax published by IETF RFC 2396. The following schemes are forbidden : javascript
JSON type
String

paymentPage.returnUrl  URI = OPTIONAL

During the redirect, the gateway will append a resultIndicator parameter to this URL. This parameter determines the result of the payment. See Obtain the Payment Result section.
Existence
OPTIONAL
Fixed value
Validation Rules
Data must be an absolute URI conforming to the URI syntax published by IETF RFC 2396. The following schemes are forbidden : javascript
JSON type
String

transaction   = OPTIONAL

Information about this transaction.
Fixed value

transaction.source  Enumeration = OPTIONAL

Existence
OPTIONAL
Fixed value
Validation Rules
JSON type
String
Value must be a member of the following list. The values are case sensitive.
CALL_CENTRE
Transaction conducted via a call centre.
CARD_PRESENT
Transaction where the card is presented to the merchant.
INTERNET
Transaction conducted over the Internet.
MAIL_ORDER
Transaction received by mail.
MOTO
Transaction received by mail or telephone.
TELEPHONE_ORDER
Transaction received by telephone.
VOICE_RESPONSE
Transaction conducted by a voice/DTMF recognition system.

{merchantId}  Alphanumeric + additional characters COMPULSORY

Existence
COMPULSORY
Validation Rules
Data may consist of the characters 0-9, a-z, A-Z, '-', '_'
XSD type
string
minimum length
1
maximum length
40

Response Parameters

merchant  Alphanumeric + additional characters = Always Provided

Existence
Always Provided
Fixed value
Validation Rules
Data may consist of the characters 0-9, a-z, A-Z, '-', '_'
JSON type
String
minimum length
1
maximum length
40

result  Enumeration = Always Provided

Existence
Always Provided
Fixed value
Validation Rules
JSON type
String
Value must be a member of the following list. The values are case sensitive.
FAILURE
The operation was declined or rejected by the gateway, acquirer or issuer
PENDING
The operation is currently in progress or pending processing
SUCCESS
The operation was successfully processed
UNKNOWN
The result of the operation is unknown

session.id  ASCII Text = Always Provided

Include this identifier in the payment page request if you wish to return the payer to the merchant's website after completing the payment attempt.
Existence
Always Provided
Fixed value
Validation Rules
Data consists of ASCII characters
JSON type
String
minimum length
31
maximum length
35

successIndicator  ASCII Text = Always Provided

The gateway will return this value in the resultIndicator parameter (appended to the returnUrl) for successful payments only. See Obtain the Payment Result section.
Existence
Always Provided
Fixed value
Validation Rules
Data consists of ASCII characters
JSON type
String
minimum length
16
maximum length
32

correlationId  String = CONDITIONAL

The value provided is not validated, does not persist in the gateway, and is returned as provided in the response to the request.
Existence
CONDITIONAL
Fixed value
Validation Rules
Data can consist of any characters
XSD type
string
minimum length
1
maximum length
100

merchant  Alphanumeric + additional characters = Always Provided

Existence
Always Provided
Fixed value
Validation Rules
Data may consist of the characters 0-9, a-z, A-Z, '-', '_'
JSON type
String
minimum length
1
maximum length
40

result  Enumeration = Always Provided

Existence
Always Provided
Fixed value
Validation Rules
JSON type
String
Value must be a member of the following list. The values are case sensitive.
FAILURE
The operation was declined or rejected by the gateway, acquirer or issuer
PENDING
The operation is currently in progress or pending processing
SUCCESS
The operation was successfully processed
UNKNOWN
The result of the operation is unknown

session.id  ASCII Text = Always Provided

Include this identifier in the payment page request if you wish to return the payer to the merchant's website after completing the payment attempt.
Existence
Always Provided
Fixed value
Validation Rules
Data consists of ASCII characters
JSON type
String
minimum length
31
maximum length
35

successIndicator  ASCII Text = Always Provided

The gateway will return this value in the resultIndicator parameter (appended to the returnUrl) for successful payments only. See Obtain the Payment Result section.
Existence
Always Provided
Fixed value
Validation Rules
Data consists of ASCII characters
JSON type
String
minimum length
16
maximum length
32

error   = CONDITIONAL

Information on possible error conditions that may occur while processing an operation using the API.
Fixed value

error.cause  Enumeration = CONDITIONAL

For example, errors may occur due to invalid requests or internal system failures.
Fixed value
Validation Rules
JSON type
String
Value must be a member of the following list. The values are case sensitive.
CONSTRAINT_VIOLATION
The request was rejected due to the request parameters violating the constraints.
INVALID_REQUEST
The request was rejected because it did not conform to the API protocol.
REQUEST_REJECTED
The request was rejected due to security reasons such as firewall rules, expired certificate, etc.
SERVER_BUSY
The server did not have enough resources to process the request at the moment.
SERVER_FAILED
There was an internal system failure.

error.explanation  String = CONDITIONAL

This field is returned only if the cause is INVALID_REQUEST, SERVER_BUSY or CONSTRAINT_VIOLATION.
Fixed value
Validation Rules
Data can consist of any characters
JSON type
String
minimum length
1
maximum length
1000

error.field  String = CONDITIONAL

This field is returned only if the cause is INVALID_REQUEST and a field level validation error was encountered; or if the cause is CONSTRAINT_VIOLATION and a field level constraint was violated.
Fixed value
Validation Rules
Data can consist of any characters
JSON type
String
minimum length
1
maximum length
100

error.supportCode  String = CONDITIONAL

This field is returned only if the cause is SERVER_FAILED or REQUEST_REJECTED.
Fixed value
Validation Rules
Data can consist of any characters
JSON type
String
minimum length
1
maximum length
100

error.validationType  Enumeration = CONDITIONAL

This field is returned only if the cause is INVALID_REQUEST and a field level validation error was encountered.
Fixed value
Validation Rules
JSON type
String
Value must be a member of the following list. The values are case sensitive.
INVALID
The request contained a field with a value that did not pass validation.
MISSING
The request was missing a mandatory field.
UNSUPPORTED
The request contained a field that is unsupported.

result  Enumeration = CONDITIONAL

Fixed value
Validation Rules
JSON type
String
Value must be a member of the following list. The values are case sensitive.
ERROR
The operation resulted in an error and hence cannot be processed.

Copyright © 2023 MasterCard