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

# Create payments

> Understand how to create a payment via Paymend

Create a payment by submitting a `POST` request to [/v1/payments](/api-reference/endpoint/payment).

## Mandatory fields

The basic data required to create a payment relates to:

* The value of the payment: `amount` and `currency`
* The payment method to be used: passed in the [PaymentMethod](/api-reference/objects/payment-method) object
* Payment identifiers:
  * A merchant-defined unique identifier for the payment: `merchantReference`
  * A Paymend-defined unique identifier for the store where the payment originated (eg. website): `source.storeId`
* The type of goods being purchased: `goodsType`

## Key fields

In addition to the details noted above which must be provided, we highly recommend passing the following details in all requests:

* Who initiated the payment: `source.initiatedBy` is a valuable card-on-file parameter and is mandatory to enable asynchronous processing
* Consumer and billing data: passed in the [Consumer](/api-reference/objects/consumer) and [Billing](/api-reference/objects/billing) objects, respectively. These details increase the chances of approval and help with payment identification.
* Determine the authorization type: use the `captureNow` field to actively determine whether funds are authorized and captured in a single or separate requests.

<Tip>
  If you're using Paymend for payment recovery, take a look at the [PreviousFailure](/api-reference/objects/previous-failure) object too.
  See our guide on payment recovery via Paymend [here](/recover-payments).
</Tip>

## Request

Example payment creation request (authorize and capture in one step):

```json theme={null}
{
  "amount": 12997,
  "currency": "USD",
  "merchantReference": "PAYMENT-12345",
  "goodsType": "MIXED",
  "captureNow": true,
  "source": {
    "storeId": "store_abc123",
    "initiatedBy": "CONSUMER"
  },
  "paymentMethod": {
    "type": "CARD",
    "card": {
      "number": "4111111111111111",
      "holderName": "John Doe",
      "cvv": "123",
      "expiryMonth": "12",
      "expiryYear": "2030",
      "brand": "VISA"
    }
  },
  "consumer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john.doe@example.com"
  },
  "billing": {
    "address": {
      "street": "123 Main Street",
      "city": "San Francisco",
      "state": "CA",
      "zip": "94105",
      "country": "US"
    }
  }
}
```

## Response

Example success response (`200 OK`):

```json theme={null}
{
  "paymentId": "pay_1234567890abcdef",
  "merchantReference": "PAYMENT-12345",
  "amount": 12997,
  "currency": "USD",
  "status": "CAPTURED",
  "goodsType": "MIXED",
  "captureNow": true,
  "source": {
    "storeId": "store_abc123",
    "initiatedBy": "CONSUMER"
  },
  "paymentMethod": {
    "type": "CARD",
    "card": {
      "bin": "41111111",
      "last4": "1111",
      "holderName": "John Doe",
      "expiryMonth": "12",
      "expiryYear": "2030",
      "brand": "VISA"
    }
  },
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-15T10:30:00Z",
  "transactions": [
    {
      "id": "SALE_pU2HnmS8AcpI",
      "type": "SALE",
      "amount": 12997,
      "result": "SUCCEEDED",
      "createdAt": "2024-01-15T10:30:00Z"
    }
  ]
}
```
