Tokenize cards

This page will explore the different ways to tokenize the customer's card within the payment process. With the creation of the Intent, there are 3 different flags you can send MoneyHash to take different paths to choose whether to tokenize it or not.

When MoneyHash creates a card token, this data will be saved on our Vault, and the token will be added as a saved_card on the respective customer entity.

Tokenization

To start, you will create an intent using the Create Intent endpoint:

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

In the payload, with the required fields (amount, amount_currency, operation and webhook_url), you first need to add the customer that will be the owner of the tokenized card:

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.

Furthermore, you will add one of the following flags, indicating the path you desire to take:

PropertyTypeDescription
tokenize_cardBooleanThis flag will define at the creation of the intent if the card should be tokenized or not. If true, MoneyHash will create the card token, and if false, it won't create it.
{
  "amount": 50,
  "amount_currency": "USD",
  "operation": "purchase",
  "customer": "0fbc1fcd-0206-46d1-8e3c-28491c17b3ce",
  "webhook_url": "https://webhook.site/4d487d3a-2644-4e48-b985-46ccd7350a29",
  "tokenize_card": true
}
PropertyTypeDescription
show_save_card_checkboxBooleanThis flag, if true will show a checkbox with the card information fields, allowing the customer to choose whether to save their card by creating the token or not.
{
  "amount": 50,
  "amount_currency": "USD",
  "operation": "purchase",
  "customer": "0fbc1fcd-0206-46d1-8e3c-28491c17b3ce",
  "webhook_url": "https://webhook.site/4d487d3a-2644-4e48-b985-46ccd7350a29",
  "show_save_card_checkbox": true
}
PropertyTypeDescription
show_mandatory_save_card_checkboxBooleanSimilar to the show_save_card_checkbox option, this will also show a checkbox with the card information fields. The difference is, in this respective flag, the customer can only proceed with the payment if they allow the card to be tokenized and saved.
{
  "amount": 50,
  "amount_currency": "USD",
  "operation": "purchase",
  "customer": "0fbc1fcd-0206-46d1-8e3c-28491c17b3ce",
  "webhook_url": "https://webhook.site/4d487d3a-2644-4e48-b985-46ccd7350a29",
  "show_mandatory_save_card_checkbox": true
}

Note

You cannot use more then one of the flags displayed above. Choose one of then to select a way to tokenize the cards.