Create an Intent

This guide will take a closer look at the intent creation, how to create, the required fields you need to send at the request, and optional fields you may want to send, depending on your scenario. Visit the Payment Components page if you aren't familiar with the intent concept.

Intent endpoints

There are two endpoints to create intents. Depending on your integration with MoneyHash, you will choose one of the options presented below:

Both endpoints are very similar. They share the same fields to perform the requests. However, the response will provide different information when using each option. For example, only the Create Intent endpoint provides the embed_url on the response, which you can use to embed the payment operation into an iframe or redirect the customer.

Required fields

You need to use one of the abovementioned endpoints to create an intent. To make an API call to MoneyHash, you need to provide the X-api-key to authenticate your request. If you aren't familiar with the MoneyHash authentication, visit the Authentication page.

There are some mandatory fields to create an intent that must be provided on the body request. The table below lists all the required fields and describes each one.

FieldTypeDescription
amountfloatThe amount to charge.
amount_currencystringThe currency of the amount is represented by a string of alphabetic code 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 POST requests to notify you of how the operation is progressing.

Optional fields

The optional fields are used to access different operations or to configure how the checkout will be presented to your customer. You can customize the appearance, hide information, or integrate customer information into the payment for further payment management and analysis, which are some configurations you can perform. For example, when creating an intent, you can set payment_method to CARD and form_only to true to allow customers to fill in their card information directly.

The table below presents all optional fields and their description.

FieldTypeDescription
custom_fieldsjsonKey value pairs of any additional information you want to save with the payment.
payment_methodstringThe name of a specific payment method you want to return for the user directly.
payment_typestringThis must be specified for card payments where the cardholder is not present (i.e., recurring or mail order/telephone order).
tokenize_cardbooleanTokenize the card before payment if the card details were entered.
card_tokenstringThe ID of a card token you wish to use to process the payment.
hide_amount_sidebarbooleanHides the payment amount overview side panel in the embed experience from the embed.
hide_headerbooleanHides MoneyHash branding header from the returned embed.
form_onlybooleanReturns the payment form only in the returned embed without any other payment choices, headers, and side panels. You need to provide the payment_method or thepayment_provider in this case.
flow_idstringPublished flow-id that should be followed for this intent.
ip_addressstringCustomer IP address, used with direct api
merchant_initiatedbooleanFlags the payment as a merchant-initiated transaction (MIT). It must be set to true for all MITs.
previous_transaction_idstringMoneyHash transaction id as UUID. Used to link the transaction to an existing series of transactions.

Some of the available options when using the optional fields are related to other MoneyHash functionalities, such as the case of flow_id. If you need help using all available options, we recommend you check the Payment section after completing the integration, where we present all available payment processes you follow using MoneyHash.