# Create a payment

Trigger a forwarded payment for an invoice belonging to one of your sub-merchants.
Send `POST /payments` with `invoice_id` and `amount` to create the forward payment in the partner API.
The payment will be forwarded from the bank account of the entity that receives payouts. If the payout receiver is the partner, the partner's bank account will be used. If the payout receiver is the sub-merchant, the sub-merchant's bank account will be used.
The invoice must be sent, and the payment amount must not exceed the invoice's outstanding balance.

Endpoint: POST /payments
Version: partners-v1
Security: bearerAuth, basicAuth

## Security:

  - `bearerAuth` (unknown)
    http bearer JWT

  - `basicAuth` (unknown)
    http basic

## Request body:

  - `application/json` (unknown)
    Create a forwarded payment for a sub-merchant's invoice. This is the partner API trigger for `POST /payments`.

## Request fields (application/json):

  - `invoice_id` (string, required)
    ID of the invoice to create a payment for. The invoice must belong to one of your sub-merchants and must be sent.
    Example: PMMlaE5wbg0

  - `amount` (number, required)
    Payment amount in dollars. Must be greater than zero and must not exceed the invoice's outstanding balance.
    Example: 1000.5

## Response 200:

  - `200` (unknown)
    An object representing a payment.

## Response 200 fields (application/json):

  - `id` (string)
    Unique identifier for the payment.
    Example: PMMlaE5wbg0

  - `customer_id` (string)
    Unique identifier of the customer that made the payment.
    Example: X50sgfRd

  - `source` (string)
    Source of the payment.
    Enum: "api", "merchant_user", "admin_user", "customer_user", "payment_gateway", "check", "guest_checkout"

  - `amount` (number)
    Amount of the payment in USD.
    Example: 1000

  - `method` (string)
    Method of payment made by the customer.
    Enum: "check", "ach_debit", "direct_deposit", "card", "merchant", "unapplied_payment_adjustment", "credit_note", "adjustment", "wire"

  - `status` (string)
    Status of the payment.
- `pending` - Payment is pending processing.
- `in_transit` - Payment has been processed and is in transit.
- `in_review` - Payment is being reviewed.
- `paid` - Payment has been confirmed and applied to the customer's account.
- `failed` - Payment failed confirmation (e.g., bank transfer or credit card payment rejected).
- `canceled` - Payment was canceled by request.
    Enum: "pending", "in_transit", "in_review", "paid", "failed", "canceled"

  - `created_at` (string)
    Date the payment was created.
    Example: 2020-01-01T00:00:00.730Z

  - `paid_at` (string)
    Date the payment was confirmed by Resolve and applied to the customer's account.
    Example: 2020-01-02T00:00:00.730Z

  - `canceled_at` (string)
    Date the payment was canceled by request.
    Example: null

  - `failed_at` (string)
    Date the payment failed processing.
    Example: null

  - `processed_at` (string)
    Date the payment was processed by Resolve.
    Example: 2020-01-01T12:00:00.730Z

  - `scheduled_at` (string)
    Date the payment was scheduled for processing, if applicable.
    Example: null

  - `processing_fee` (number)
    Processing fee for the payment.
    Example: 25.5

  - `canceled_code` (string)
    Code indicating the reason the payment was canceled.
    Example: null

  - `failed_code` (string)
    Code indicating the reason the payment failed processing.
    Example: null

  - `dispute_code` (string)
    Code indicating the reason for a payment dispute.
    Example: null

  - `forward_reason_code` (string)
    Reason code associated with a forwarded payment. This is populated when the payment was created through the merchant API and may be null for partner API-created payments.
    Enum: "ach", "check", "wire", "credit_card", "other"

  - `forward_reason_message` (string)
    Human-readable reason text associated with a forwarded payment. This is populated when the payment was created through the merchant API and may be null for partner API-created payments.
    Example: null

  - `payment_links` (array)
    List of records the payment is applied to.

  - `payment_links.record_id` (string)
    ID of the record.
    Example: PMMlaE5wbg0

  - `payment_links.record_type` (string)
    Type of record the payment is applied to.
    Enum: "invoice"

  - `payment_links.amount` (number)
    Amount applied to this record.
    Example: 500

  - `created_by_user_id` (string)
    ID of the user who created the payment, if applicable.
    Example: null

## Response 400:

  - `400` (unknown)
    Bad request error

## Response 400 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: Validation error

  - `error.type` (string)
    A short string, describing error type
    Enum: "validation_error"

  - `error.details` (array)

  - `error.details.path` (string)
    Path to the field failed validation
    Example: path.to.field

  - `error.details.message` (string)
    Detailed description of the error
    Example: `[field]` is required

## Response 401:

  - `401` (unknown)
    Unauthorized error

## Response 401 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: Invalid merchant credentials

  - `error.type` (string)
    A short string, describing error type
    Enum: "authentication_error"

## Response 404:

  - `404` (unknown)
    Not found error

## Response 404 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: [entity] not found

  - `error.type` (string)
    A short string, describing error type
    Enum: "not_found_error"

## Response 422:

  - `422` (unknown)
    Bad request error

## Response 422 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: Validation error

  - `error.type` (string)
    A short string, describing error type
    Enum: "validation_error"

  - `error.details` (array)

  - `error.details.path` (string)
    Path to the field failed validation
    Example: path.to.field

  - `error.details.message` (string)
    Detailed description of the error
    Example: `[field]` is required

## Response 429:

  - `429` (unknown)
    Rate limit error

## Response 429 fields (application/json):

  - `error` (object)

  - `error.message` (string)
    A short string, describing error details
    Example: Too many requests

  - `error.type` (string)
    A short string, describing error type
    Enum: "rate_limit_error"

