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:
- Create Intent endpoint: Used for the Embedded and SDKs integrations.
- Create Intent endpoint for API integrations: Used for the External API and Direct API integrations.
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.
Field | Type | Description |
---|---|---|
amount | float | The amount to charge. |
amount_currency | string | The currency of the amount is represented by a string of alphabetic code 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 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.
Field | Type | Description |
---|---|---|
custom_fields | json | Key value pairs of any additional information you want to save with the payment. |
payment_method | string | The name of a specific payment method you want to return for the user directly. |
payment_type | string | This must be specified for card payments where the cardholder is not present (i.e., recurring or mail order/telephone order). |
tokenize_card | boolean | Tokenize the card before payment if the card details were entered. |
card_token | string | The ID of a card token you wish to use to process the payment. |
hide_amount_sidebar | boolean | Hides the payment amount overview side panel in the embed experience from the embed. |
hide_header | boolean | Hides MoneyHash branding header from the returned embed. |
form_only | boolean | Returns 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_id | string | Published flow-id that should be followed for this intent. |
ip_address | string | Customer IP address, used with direct api |
merchant_initiated | boolean | Flags the payment as a merchant-initiated transaction (MIT). It must be set to true for all MITs. |
previous_transaction_id | string | MoneyHash 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.
Updated 6 months ago