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:

POST
/api/v1.1/payments/intent/

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:

PropertyTypeDescription
amountNumberThe amount to charge in the payment process.
amount_currencyStringThe currency of the amount is represented by a string of alphabetic codes from ISO 4217 Currency codes.
operationStringThe type of the current intent. It can be one of purchase, authorize, or capture.
merchant_initiatedBooleanIndicates if initiated by the merchant.
payment_typeStringType of payment. Must be set as regular.
webhook_urlStringA URL that the MoneyHash server will send a POST request to you when needed.
customerStringThe 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:

PropertyTypeDescription
amountNumberThe amount to charge in the payment process.
amount_currencyStringThe currency of the amount is represented by a string of alphabetic codes from ISO 4217 Currency codes.
operationStringThe type of the current intent. It can be one of purchase, authorize, or capture.
webhook_urlStringA URL that the MoneyHash server will send a POST request to you when needed.
customerStringThe unique identifier of the customer that owns the saved card.
card_tokenStringThe 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:

PropertyTypeDescription
amountNumberThe amount to charge in the payment process.
amount_currencyStringThe currency of the amount is represented by a string of alphabetic codes from ISO 4217 Currency codes.
operationStringThe type of the current intent. It can be one of purchase, authorize, or capture.
webhook_urlStringA URL that the MoneyHash server will send a POST request to you when needed.
customerStringThe unique identifier of the customer that owns the saved card.
card_tokenStringThe unique identifier of a card token you wish to process this payment.card_token_data
card_token_dataObjectAn object with a tokenized card extra information. You can add a CVV here.
card_token_data.cvvStringThe 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:

POST
/api/v1.1/payments/charge-card-token/

Add the following fields to the required payload:

PropertyTypeDescription
amountNumberThe amount to charge in the payment process.
amount_currencyStringThe currency of the amount is represented by a string of alphabetic codes from ISO 4217 Currency codes.
operationStringThe type of the current intent. It can be one of purchase, authorize, or capture.
webhook_urlStringA URL that the MoneyHash server will send a POST request to you when needed.
customerStringThe unique identifier of the customer that owns the saved card.
card_tokenStringThe unique identifier of a card token to process the payment.
card_token_dataObjectAn object with tokenized card extra information. You can add CVV here.
card_token_data.cvvStringThe 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.