Pay with a Card Token
This page will present ways to use your customer's saved card to present customized checkout options. MoneyHash lets you set a customer's tokenized card as the payment method when creating the intent. As a result, you eliminate the need for them to select a payment method manually. In addition, you can present all saved cards as options at the payment method selection step.
Paying with card tokens
To start, you will create an intent using the Create Intent endpoint:
There are two options to use card tokens. You can either present the customer with their saved cards as payment method options, or you can directly send the card token when starting the payment process to select a saved card as payment method directly.
Showing the customer's saved cards
To be able to present your customers with their saved payment methods, you need to add to the payload the respective customer's unique identifier:
Property | Type | Description |
---|---|---|
amount | Number | The amount to charge in the payment process. |
amount_currency | String | The currency of the amount is represented by a string of alphabetic codes from ISO 4217 Currency codes. |
operation | String | The type of the current intent. It can be one of purchase , authorize , or capture . |
merchant_initiated | Boolean | Indicates if initiated by the merchant. |
payment_type | String | Type of payment. Must be set as regular . |
webhook_url | String | A URL that the MoneyHash server will send a POST request to you when needed. |
customer | String | The unique identifier of the customer that owns the saved card. |
{
"amount": 50,
"amount_currency": "usd",
"customer": "c6c42108-293f-44c9-92fc-5d6ef2003b33",
"operation": "purchase",
"webhook_url": "https://webhook.site/b8954509-f628-4805-a4b4-58a0fb2be958"
}
When you create the intent, providing the customer
unique identifier, when they reach the payment selection step, all saved cards will be available for selection.
Using a card token directly
To directly choose a card token to execute the payment during the intent creation, you need to add different fields to the payload depending on whether you're using the CVV.
Without CVV
Send the card_token
with the customer to use the selected saved card as the payment method:
Property | Type | Description |
---|---|---|
amount | Number | The amount to charge in the payment process. |
amount_currency | String | The currency of the amount is represented by a string of alphabetic codes from ISO 4217 Currency codes. |
operation | String | The type of the current intent. It can be one of purchase , authorize , or capture . |
webhook_url | String | A URL that the MoneyHash server will send a POST request to you when needed. |
customer | String | The unique identifier of the customer that owns the saved card. |
card_token | String | The unique identifier of a card token you wish to process this payment. |
With the card_token
in the payload, your customer will skip the method selection step, being presented with a step to fill in the CVV of their saved_card
to proceed.
With CVV
You can send the CVV along with the intent's payload by adding the following fields:
Property | Type | Description |
---|---|---|
amount | Number | The amount to charge in the payment process. |
amount_currency | String | The currency of the amount is represented by a string of alphabetic codes from ISO 4217 Currency codes. |
operation | String | The type of the current intent. It can be one of purchase , authorize , or capture . |
webhook_url | String | A URL that the MoneyHash server will send a POST request to you when needed. |
customer | String | The unique identifier of the customer that owns the saved card. |
card_token | String | The unique identifier of a card token you wish to process this payment.card_token_data |
card_token_data | Object | An object with a tokenized card extra information. You can add a CVV here. |
card_token_data.cvv | String | The Card Verification Value. |
By adding the CVV, your customers can pay automatically, as they won't be required to choose or fill in anything.
{
"amount": 50,
"amount_currency": "usd",
"customer": "c6c42108-293f-44c9-92fc-5d6ef2003b33",
"operation": "purchase",
"card_token": "408a473d-3e7d-4a1b-b8c4-6a846473b218",
"card_token_data": {
"cvv": "123"
},
"webhook_url": "https://webhook.site/b8954509-f628-4805-a4b4-58a0fb2be958"
}
Using the card token JSON endpoint
This option is a different endpoint that requires the customer
, card_token
, card_token_data.cvv
along with the default parameters shown below to execute a payment directly. Here, you will receive a response JSON informing you of the payment status and will not be presented with information such as embed_url
.
You need to start by creating an Intent<>/b with the Charge Card token endpoint:
Add the following fields to the required payload:
Property | Type | Description |
---|---|---|
amount | Number | The amount to charge in the payment process. |
amount_currency | String | The currency of the amount is represented by a string of alphabetic codes from ISO 4217 Currency codes. |
operation | String | The type of the current intent. It can be one of purchase , authorize , or capture . |
webhook_url | String | A URL that the MoneyHash server will send a POST request to you when needed. |
customer | String | The unique identifier of the customer that owns the saved card. |
card_token | String | The unique identifier of a card token to process the payment. |
card_token_data | Object | An object with tokenized card extra information. You can add CVV here. |
card_token_data.cvv | String | The Card Verification Value (CVV). |
After executing this endpoint, in the response JSON, you will have access to the status
of the payment. With the status in hand, you can guide your customer as you better see fit for each status received.
From here, you can proceed with any integration except the HPP one.
Keep track of the webhook endpoint you sent within the request to see the progress of the payment process.
Updated 9 months ago