Create a Customer with a Payment

On this page, you find a guide on creating a new customer entity while starting a new payment process.

When a new customer is created along with the payment process, everything related to the transaction that is happening will already be connected to this new customer entity that was just created. You will also receive webhooks related to every step from customer.created event to intent.processed.

Creating a new customer

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

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

To create a customer when creating the intent, you need to provide additional information to the endpoint request. The required information is displayed in the table below:

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.
create_customerBooleanSet this flag as true to inform MoneyHash that a customer needs to be created.
customer_detailsObjectThe object with the details of the customer.
customer_details.first_nameStringThe customer's first name.
customer_details.last_nameStringThe customer's last name.
customer_details.emailStringThe customer's email address.
customer_details.phone_numberStringThe customer's phone number.
customer_details.descriptionStringA description of the respective customer (optional).
{
  "amount": 50,
  "amount_currency": "usd",
  "operation": "purchase",
  "create_customer": true,
  "customer_details": {
    "first_name": "test",
    "last_name": "customer",
    "email": "[email protected]",
    "phone_number": "+201234567891",
    "description": "test description"
  },
  "webhook_url": "https://webhook.site/b8954509-f628-4805-a4b4-58a0fb2be958"
}

From here, you are able to 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.