Overview
Making an API call to create an instance of a Checkout Component is a crucial step in capitalizing on an iframe configuration. It is the call that returns the bearer token value that is used to render the Checkout Component within an HTML iframe.
However, getting the bearer token is just one of the features of this endpoint. Another important feature to note is that this endpoint also provides parameters you can use to pre-fill form fields, like billing and shipping address fields for your customers, and also the ability to change a configuration when the instance is being created. This may be required if you want a specific instance of the Checkout Component to be a bit different than the standard configuration that is set up. The purpose is to set up settings specific to the customer's own iframe instance, eliminating the need for repetitive PATCH operations on an iframe configuration. The PATCH operators may as well lead to a lot of conflicts.
Similar to our guide on creating a configuration, this guide is written to help you have a deeper understanding of the different options at your disposal when you create an instance of a Checkout Component.
Note
To find out which parameters are required or optional and their values, see the comprehensive API Reference.
API Request
After you create a configuration, the only parameter required in the body when an instance is created is the label parameter in the general settings - see below.
POST /api/v4/accounts/{accountId}/payment-iframe/{resourceId}/instance/init
Note
The
{accountId}value in the path would be the PayConex™ account ID number.The
{resourceId}value would be theidvalue of a previously created Checkout Component configuration.
{
"label": "my-instance-1",
"amount": "20",
"threeDSecureInitSettings": {
"transactionType": "GOODS_SERVICE_PURCHASE",
"deliveryTimeFrame": "ELECTRONIC_DELIVERY",
"threeDSecureChallengeIndicator": "NO_PREFERENCE",
"reorderIndicator": "FIRST_TIME_ORDERED",
"shippingIndicator": "BILLING_ADDRESS"
}
}
*Required Scopes: pcx:iframe:instance:*, pcx:iframe:instance:create
Note
With no
amountfield specified, the transaction is considered zero-amount and is used withsavePaymentOptionchecked.The other request parameters provided by this API give you the ability to change the default behavior of the original Checkout Component configuration.
The
threeDSecureInitSettingsparameter is required only withthreeDSecureset to"required"and one of theallowedPaymentMethodsbeing"CARD"or"GOOGLE_PAY". For more on 3D Secure and how to use it, check out Bluefin 3DS Support.
General Settings
The general settings are a set of configuration options that define specific behaviors of a Checkout Component.
| Parameter | Type | Description | Example |
|---|---|---|---|
label | string | A friendly name for the Checkout Component instance. | "Card only iframe" |
bfTokenReferences | array | See below. | [ "bft_fda0f58e4b5647cba75a21b7559e64f1", "bft_3caf8413e99443d18c379399beff708c" ] |
reference | string | A custom merchant reference ID for the instance. | "c73bcdcc-2669-4bf6-81d3-e4ae73fb11fd" |
customer | object | Customer's name, email, phone, and billing address. | See below. |
shippingAddress | object | Shipping address information. | See below. |
language | string | The language setting for the form. | "ENGLISH" |
timeout | integer | The user interaction limit timeout in seconds. This timeout kicks off as soon as an iframe instance is created. | 600 |
amount | string | The transaction amount. | "27.98" |
currency | string | The currency for transactions. | "USD" |
initializeTransaction | boolean | Indicates if the transaction should be initialized. If set to true, a PayConex™ transactionId is provided and returned in the API response body and this identifier is used for the subsequent transaction. See Initializing a Transaction. | false |
allowedPaymentMethods | array | List of payment methods to support. Enumerations include: "CARD", "ACH", "GOOGLE_PAY", "CLICK_TO_PAY". | ["CARD", "ACH"] |
achSettings | object | ACH Payment settings. | See below. |
cardSettings | object | Card payment settings. | See below. |
threeDSecureInitSettings | object | 3DS Settings. | See below. |
clickToPaySettings | object | Mastercard Click to Pay settings. | See below. |
googlePaySettings | object | Google Pay settings. | See below. |
savePaymentOption | string | Specifies if saving payment is allowed. If set to "required", the transaction returns the reissuing token. Enumerations:- "required": Payment must be saved- "optional": The user has the option to save the payment- "omit": There is no option to save the payment | "required" |
bfTokenReferences
bfTokenReferencesA list of token references that are used as saved cards so that the customer doesn't need to re-input their card data during their next checkout in the future. This means a faster checkout - with only a few clicks to complete their purchase. The customer is still required to confirm their CVV.
The customer is required to check the Save payment method in order to have the token reference reusable as a saved card. This allows the customer to consent to the secure encryption and storage of their sensitive card data.
The merchant must ensure to process an authorization or sale transaction within 10 minutes (token's lifespan). Otherwise, the token cannot be used as a saved card and is ignored in the Checkout Component.
To see the Checkout Component interface with the saved cards, refer to Customer Checkout | Credit/Debit Card.
PCI Scope
These tokens can be securely utilized or stored on the merchant's server, significantly reducing the vendor's or merchant's PCI footprint.
The merchant/developer must use
data.meta.savePaymentOptionto determine if they are allowed to store the token reference in their database as saved cards. See Using the SDK | Credit/Debit Card.For more information, refer to PayConex™ API Introduction and PayConex™ and ShieldConex®.
Note
This feature is primarily used with the
allowedPaymentMethodsbeing Bluefin'sCARDas Google Pay and Mastercard Click to Pay have their own implementation of saving card data and managing it.Prior to the checkout, it is up to the merchant to indicate to the customer whether they are using their card reference for MIT recurring payments or saved cards.
Request Example
POST /api/v4/accounts/{accountId}/payment-iframe/{resourceId}/instance/init
{
"label": "my-instance-1",
"amount": "20",
"bfTokenReferences": [
"bft_fda0f58e4b5647cba75a21b7559e64f1",
"bft_3caf8413e99443d18c379399beff708c"
],
"threeDSecureInitSettings": {
"transactionType": "GOODS_SERVICE_PURCHASE",
"deliveryTimeFrame": "ELECTRONIC_DELIVERY",
"threeDSecureChallengeIndicator": "NO_PREFERENCE",
"reorderIndicator": "FIRST_TIME_ORDERED",
"shippingIndicator": "BILLING_ADDRESS"
}
}
*Required Scopes: pcx:iframe:instance:*, pcx:iframe:instance:create
customer
customerThe customer object allows you to pre-fill the Checkout Component form elements with your customer-related information such as name, email, phone, and billing address.
| Parameter | Type | Description | Example |
|---|---|---|---|
customer.name | string | Customer's name. | "Jane Smith" |
customer.email | string | Customer's email address. | "[[email protected]](mailto:[email protected])" |
customer.phone | string | Customer's phone number. | "+14441234321" |
customer.billingAddress.address1 | string | Address line 1. | "123 Plain St" |
customer.billingAddress.address2 | string | Address line 2. | "West Side" |
customer.billingAddress.city | string | City. | "Atlanta" |
customer.billingAddress.state | string | State. | "GA" |
customer.billingAddress.zip | string | Zip code. | "90210" |
customer.billingAddress.country | string | Country. | "USA" |
customer.billingAddress.company | string | Company name. | "Acme Inc." |
shippingAddress
shippingAddressThe shippingAddress object allows you to pre-fill the Checkout Component form elements with the customer's shipping address information.
| Parameter | Type | Description | Example |
|---|---|---|---|
shippingAddress.address1 | string | Address line 1. | "123 Plain St" |
shippingAddress.address2 | string | Address line 2. | "West Side" |
shippingAddress.city | string | City. | "Atlanta" |
shippingAddress.state | string | State. | "GA" |
shippingAddress.zip | string | Zip code. | "90210" |
shippingAddress.country | string | Country. | "USA" |
shippingAddress.company | string | Company name. | "Acme Inc." |
shippingAddress.recipient | string | Recipient name. | "Jane Smith" |
shippingAddress.recipientPhone | string | Recipient phone number. | "1234567890" |
achSettings
achSettingsThe achSettings object is a set of configuration options that define specific behaviors of the Checkout Component when a user selects the ACH option as their preferred payment method.
This is required only if ACH is one of the items in the allowedPaymentMethods array.
| Parameter | Type | Description | Example |
|---|---|---|---|
billingAddress.address1 | string | Specifies whether address line 1 is required. | "required" |
billingAddress.address2 | string | Specifies whether address line 2 is required. | "optional" |
billingAddress.city | string | Specifies whether city is required. | "required" |
billingAddress.state | string | Specifies whether state is required. | "required" |
billingAddress.zip | string | Specifies whether zip code is required. | "required" |
capturePhone | string | Specifies whether contact information is required. | "required" |
captureEmail | string | Specifies whether email is required. | "required" |
captureShippingAddress | boolean | Specifies whether shipping address should be captured. | false |
cardSettings
cardSettingsThe cardSettings object is a set of configuration options that define specific behaviors of the Checkout Component when a user selects the credit card option as their preferred payment method.
Like the rest of the individual payment settings, this setting is required only if CARD is one of the allowedPaymentMethods array.
| Parameter | Type | Description | Example |
|---|---|---|---|
cvv | string | Specifies whether CVV is required. | "required" |
billingAddress.address1 | string | Specifies whether address line 1 is required. | "required" |
billingAddress.address2 | string | Specifies whether address line 2 is required. | "optional" |
billingAddress.city | string | Specifies whether city is required. | "required" |
billingAddress.state | string | Specifies whether state is required. | "required" |
billingAddress.zip | string | Specifies whether zip code is required. | "required" |
capturePhone | string | Specifies whether contact information is required. | "required" |
captureEmail | string | Specifies whether email is required. | "required" |
captureShippingAddress | boolean | Specifies whether shipping address should be captured. | false |
threeDSecure | string | Specifies whether 3DS attempt is required. For more on 3D Secure and how to set it up, check out Bluefin 3DS Support. | "required" |
threeDSecureInitSettings
threeDSecureInitSettingsThe threeDSecureInitSettings object allows you to initialize the Checkout Component with information required to be sent when trying to qualify for 3D Secure chargeback protections.
Note
This setting is required only with
threeDSecureset to"required"and one of theallowedPaymentMethodsbeing"CARD"or"GOOGLE_PAY".
| Parameter | Type | Description | Example |
|---|---|---|---|
transactionType | string | Transaction type. | "GOODS_SERVICE_PURCHASE" |
deliveryTimeFrame | string | Delivery time frame. | "ELECTRONIC_DELIVERY" |
threeDSecureChallengeIndicator | string | 3D Secure challenge indicator. | "NO_PREFERENCE" |
reorderIndicator | string | Reorder indicator. | "FIRST_TIME_ORDERED" |
shippingIndicator | string | Shipping indicator. | "BILLING_ADDRESS" |
Integrating 3D Secure
For more on 3D Secure and how to use it, check out Bluefin 3DS Support.
clickToPaySettings
clickToPaySettingsThe Click to Pay settings are a set of configuration options that define specific behaviors of the Checkout Component when a user selects Click to Pay as their preferred payment method.
This setting is required only if CLICK_TO_PAY is one of the items in the allowedPaymentMethods array.
Note
These parameters are directly integrated as the essential Click to Pay parameters. See Mastercard Click to Pay JavaScript Methods.
| Parameter | Type | Description | Example |
|---|---|---|---|
srcDpaId | string | ID for the digital payment app being used. | "3fa85f64-5717-4562-b3fc-2c963f66afa6" |
dpaName | string | Name of the digital payment app. | "PayConex" |
dpaPresentationName | string | Presentation name of the digital payment app. | "PayConex App" |
allowedCardBrands | array | List of card brands to accept. Possible values: "VISA", "MASTERCARD", "AMERICAN_EXPRESS", "DISCOVER", "CHINA_UNION_PAY". | ["VISA", "MASTERCARD"] |
captureShippingAddress | boolean | Specifies whether shipping address should be captured. | false |
googlePaySettings
googlePaySettingsThe Google Pay settings are a set of configuration options that define specific behaviors of the Checkout Component when a user selects Google Pay as their preferred payment method.
This setting is required only if GOOGLE_PAY is one of the items in the allowedPaymentMethods array.
Note
These parameters are directly integrated as the essential GPay parameters via the Google Pay web API. Also see Google Pay Setup.
| Parameter | Type | Description | Example |
|---|---|---|---|
merchantId | string | Merchant ID for Google Pay. | "12345678901234567890" |
merchantName | string | Merchant name for Google Pay. | "Demo Merchant" |
billingAddressRequired | bool | Specifies whether the billing address is required. If set to false, it is optional. | true |
billingAddressParameters.format | string | Enable either minimal or full billing address parameters: "MIN", "FULL". Minimal includes address1, city, zip. | "FULL" |
billingAddressParameters.phoneNumberRequired | bool | In addition to specifying a minimal or full billing address, it also indicates whether a phone number is required. | true |
shippingAddressRequired | bool | Specifies whether the shipping address is required. If set to false, it is optional. | true |
shippingAddressParameters.allowedCountryCodes | array | Allowed country codes for the shipping address, e.g. "US". | [ "US" ] |
shippingAddressParameters.phoneNumberRequired | bool | Specifies whether the phone number is required as part of the shipping address. | true |
emailRequired | bool | Whether the user has the option to save the email address. | true |
allowedAuthMethods | array | List of allowed authentication methods. Possible values: "PAN_ONLY", "CRYPTOGRAM_3DS".For more, see Payment data cryptography for merchants | CRYPTOGRAM_3DS. | ["PAN_ONLY", "CRYPTOGRAM_3DS"] |
allowedCardBrands | array | List of allowed card brands. Possible values: "VISA", "MASTERCARD", "AMERICAN_EXPRESS", "DISCOVER", "JCB", "INTERAC". | ["VISA", "MASTERCARD"] |
threeDSecure | string | Specifies whether the 3DS attempt is required. [ "required", "omit" ].This option allows for Bluefin 3DS Solution as a step-up authentication for Google Pay PAN_ONLY transactions.As a result, the threeDSecureInitSettings are reused for this feature. For more on 3D Secure and how to set it up, check out Bluefin 3DS Support. | "required" |
Important
- Make sure that you apply your existing risk checks and controls for payment transactions to Google Pay transactions. Google Pay validation and fraud checks are not intended to replace your risk management processes.
- If you support
PAN_ONLY, ensure that you trigger 3D Secure (step-up authentication) for Google PayPAN_ONLYtransactions in the same way that you trigger 3D Secure for normal card transactions.
Example Request Body
POST /api/v4/accounts/{accountId}/payment-iframe/{resourceId}/instance/init
{
"allowedPaymentMethods": [
"CARD",
"ACH",
"GOOGLE_PAY",
"CLICK_TO_PAY"
],
"label": "Multi-Payment iframe instance",
"reference": "c73bcdcc-2669-4bf6-81d3-e4ae73fb11fd",
"initializeTransaction": true,
"amount": "20",
"timeout": 600,
"currency": "USD",
"customer": {
"name": "Jane Smith",
"email": "[email protected]",
"phone": "+14441234321",
"billingAddress": {
"address1": "123 Plain St",
"address2": "West Side",
"city": "Atlanta",
"state": "GA",
"zip": "90210",
"country": "USA",
"company": "Acme Inc."
}
},
"shippingAddress": {
"address1": "123 Plain St",
"address2": "West Side",
"city": "Atlanta",
"state": "GA",
"zip": "90210",
"country": "USA",
"company": "Acme Inc.",
"recipient": "Jane Smith",
"recipientPhone": "1234567890"
},
"cardSettings": {
"cvv": "required",
"billingAddress": {
"address1": "required",
"address2": "optional",
"city": "required",
"state": "required",
"zip": "required"
},
"capturePhone": "omit",
"threeDSecure": "required",
"captureEmail": "omit",
"captureShippingAddress": false
},
"achSettings": {
"billingAddress": {
"address1": "required",
"address2": "optional",
"city": "required",
"state": "required",
"zip": "required"
},
"capturePhone": "omit",
"captureEmail": "omit",
"captureShippingAddress": false
},
"clickToPaySettings": {
"srcDpaId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"dpaName": "PayConex",
"dpaPresentationName": "PayConex App",
"allowedCardBrands": [
"VISA",
"MASTERCARD",
"AMERICAN_EXPRESS",
"DISCOVER",
"CHINA_UNION_PAY"
]
},
"googlePaySettings": {
"merchantId": "12345678901234567890",
"merchantName": "Demo Merchant",
"billingAddressRequired": true,
"shippingAddressRequired": true,
"emailRequired": true,
"billingAddressParameters": {
"format": "MIN",
"phoneNumberRequired": true
},
"shippingAddressParameters": {
"allowedCountryCodes": ["US"],
"phoneNumberRequired": true
},
"allowedAuthMethods": [
"PAN_ONLY",
"CRYPTOGRAM_3DS"
],
"allowedCardBrands": [
"VISA",
"MASTERCARD",
"AMERICAN_EXPRESS",
"DISCOVER",
"JCB",
"INTERAC"
],
"threeDSecure": "omit"
},
"threeDSecureInitSettings": {
"transactionType": "GOODS_SERVICE_PURCHASE",
"deliveryTimeFrame": "ELECTRONIC_DELIVERY",
"threeDSecureChallengeIndicator": "NO_PREFERENCE",
"reorderIndicator": "FIRST_TIME_ORDERED",
"shippingIndicator": "BILLING_ADDRESS"
},
"savePaymentOption": "required"
}
*Required Scopes: pcx:iframe:instance:*, pcx:iframe:instance:create
Example Response
{
"id": "ifri_d193148ac2624de7b43a191682a8822f",
"bearerToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"transactionId": "120615523104"
}
| Parameter | Type | Description |
|---|---|---|
id | string | The unique identifier of the created instance. |
bearerToken | string | The token used to initialize the Checkout Component SDK. |
transactionId | string | The initialized transaction as a database entry. See Initializing a Transaction. |
Overwriting Configuration
Take the following example: if our global iframe configuration enables all payment methods, but the customer requires strictly a subset or only needs some fields pre-filled because they are a returning customer, we can overwrite the settings accordingly. We can also set savePaymentOption to omit if the customer wants this to be only a one-time transaction. Alternatively, setting it to optional allows the customer to decide whether to check that box. For the illustrated workflow, see Checkout Component Tokenization.
Request Body
POST /api/v4/accounts/{accountId}/payment-iframe/{resourceId}/instance/init
{
"allowedPaymentMethods": [
"CARD"
],
"label": "Multi-Payment iframe instance",
"reference": "c73bcdcc-2669-4bf6-81d3-e4ae73fb11fd",
"initializeTransaction": true,
"amount": "20",
"timeout": 600,
"currency": "USD",
"customer": {
"name": "Jane Smith",
"email": "[email protected]",
"phone": "+14441234321",
"billingAddress": {
"address1": "123 Plain St",
"address2": "West Side",
"city": "Atlanta",
"state": "GA",
"zip": "90210",
"country": "USA",
"company": "Acme Inc."
}
},
"shippingAddress": {
"address1": "123 Plain St",
"address2": "West Side",
"city": "Atlanta",
"state": "GA",
"zip": "90210",
"country": "USA",
"company": "Acme Inc.",
"recipient": "Jane Smith",
"recipientPhone": "1234567890"
},
"cardSettings": {
"cvv": "required",
"billingAddress": {
"address1": "required",
"address2": "optional",
"city": "required",
"state": "required",
"zip": "required"
},
"capturePhone": "omit",
"threeDSecure": "required",
"captureEmail": "omit",
"captureShippingAddress": false
},
"threeDSecureInitSettings": {
"transactionType": "GOODS_SERVICE_PURCHASE",
"deliveryTimeFrame": "ELECTRONIC_DELIVERY",
"threeDSecureChallengeIndicator": "NO_PREFERENCE",
"reorderIndicator": "FIRST_TIME_ORDERED",
"shippingIndicator": "BILLING_ADDRESS"
},
"savePaymentOption": "optional"
}
*Required Scopes: pcx:iframe:instance:*, pcx:iframe:instance:create
