> ## Documentation Index
> Fetch the complete documentation index at: https://docs.y.uno/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Payments

On this page, you will find a walk-through guide on creating a payment and the necessary information to accomplish such a task.

## Requirements

Before starting following the steps described in this guide, you need to:

* Access your [API credentials](/docs/using-yuno/settings/developers-credentials) on the Yuno Dashboard, which are composed of:
  * `public-api-key`
  * `private-secret-key`
  * `account_id`
* [Set up your connections](/docs/using-yuno/dashboard-overview/connections) on your Yuno Dashboard account.
* [Build a route](/docs/using-yuno/dashboard-overview/routing) for the payment method to define how it will be processed.

Make sure to complete these requirements before following the create payment guide.

<Note>
  **Explore Yuno Postman Collections**

  Yuno provides [Postman Collections](/reference/postman-collections) that you can use to replicate the use cases locally.
</Note>

<Warning>
  **Enable Yuno Test Payment Gateway**

  To test a simple card payment in the **sandbox environment**, you must first enable the [Yuno Test Payment Gateway](/docs/direct-integration-use-cases/yuno-testing-gateway). This connection simulates a provider and allows you to verify your direct integration without using real card data.
</Warning>

## Steps summary

The create payment process normally requires finishing the two steps listed below.

1. [Create a customer](/reference/customers/create-customer)
2. [Create the payment](#step-2-create-a-payment)

<Note>
  **Additional payment methods and functionalities**

  Different payment methods, such as with specific wallets or BNPL, or functionalities, such as split payments, may require additional steps before creating the payment.
</Note>

## Create a payment

### Step 1: Create a customer

Use the [Create Customer](/reference/customers/create-customer) to register the customer info. You will need to provide personal customer information. In addition, you also need to supply the `merchant_customer_id`, a unique identifier for the customer used on your system.

<Note>
  **Customer complementary information**

  When creating a **Customer**, certain information is not required but can improve the user's payment experience if provided. Phone, billing address, and shipping address are examples of not mandatory data you can provide.

  If you add optional information, be aware of the required mandatory fields.
</Note>

At the end of the create a customer process, you will receive an `id`, which identifies the user within the Yuno system. Use the `id` to initialize the checkout.

If you are creating a payment for an existing user who was previously created and already had an `id` you can skip this step.

### Step 2: Create a payment

You will create a payment using the endpoint [Create Payment](/reference/payments/create-payment). With Yuno, you can create payments with several payment methods, using 3DS or split payments. However, this guide focuses on a simple payment without additional authentication, validation, or enrollment requirements.

Below, you find a deeper description of how to create a payment.

#### 2.1 Provide the required attributes

Provide customer-related information, including the `customer_payer` object that contains the `id` from Step 1.

Certain objects are not mandatory when creating a payment. However, if you provide this information, the user’s payment experience will be enhanced. Be aware of the mandatory fields if you wish to provide this information.

#### 2.2 Choose the capture type

Yuno provides two options for payment capture:

* Single-step: Authorization and capture are performed simultaneously. You only need to create the payment. The authorization and capture are performed automatically. For the single-step option, you need to send the attribute `capture` as `true` on the request.
* Two steps: Authorization and capture are performed at different moments. After creating the payment, you will need to perform an authorization request and a capture request.  If you wish to process the payment in Two Steps, send `capture` as `false` and after creating the payment, use the [Authorize Payment](/reference/payments/authorize-payment) and the [Capture Authorization](/reference/payments/capture-authorization) to complete the process.

#### 2.3 Additional features

Yuno also lets you use some additional features that are supported in the basic payment creation process:

* `vault_on_success`: If your customer uses a credit card to make the payment, we let you enroll that payment method for the customer for future purchases in the same step.
* `installments`: In case you offer your clients installments for their payments and your chosen processor accepts them, you can send us the amount of installments to create the payment with.

Both fields can be found in the payment\_method detail section of the payment.

<Note>
  To generate and receive a <code>vaulted\_token</code> when <code>vault\_on\_success = true</code>, the payment must reference an existing Yuno customer through <code>customer\_payer.id</code>. Creating or sending the customer data inline inside the payment request does not create the customer on our side, so no vaulting will occur. When these conditions are met and the payment status is <code>SUCCEEDED</code>, the <code>vaulted\_token</code> will be returned in the payment response and can be used for future transactions.
</Note>

### Step 3: Check the payment status

After performing the request to the [Create Payment](/reference/payments/create-payment) endpoint, you can check the payment status by analyzing the `status` and `sub_status` from the response. Check the page [Payment Status](/reference/payments/status-and-response-codes/payment) to see all options you can receive in response to the payment creation request.

Depending on the processor and payment method, the status may take some time to update. Therefore, you may need to use endpoints to recover the payment status. To perform this task, you can use the [Retrieve Payment by ID](/reference/payments/retrieve-payment-by-id) or [Retrieve Payment by merchant\_order\_id](/reference/payments/retrieve-payment-by-merchant-order-id). Another option is to use webhooks to receive notifications after each event. Yuno recommends you use webhooks to monitor asynchronous payments better. Check the [Webhooks](/docs/webhooks) guide to learn how to configure the webhooks solution provided by Yuno.

<Note>
  **Test Card Payments**

  If you need to test Card payments in general, Yuno provides the Yuno Test Payment Gateway. It works as a connection, however, it is available only in the sandbox environment. Check the [Yuno Test Payment Gateway page](/docs/direct-integration-use-cases/yuno-testing-gateway) to learn all functionalities, or go directly to the guide on [how to test card payments](/docs/direct-integration-use-cases/yuno-testing-gateway#test-card-payments-with-yuno-testing-gateway).
</Note>
