# Create a payment

Creates a payment for an order or subscription. For initial payments, card details and a callback URL are required. For subsequent payments on `as_presented` subscriptions, the card from the last successful payment is reused, and `request_id`, `amount`, and `currency` are required instead.
Either `order_id` or `subscription_id` must be provided, but not both.
On a `subsequent` auto debit for an `as_presented` subscription, pass `split_ids` to price that charge from your declared share of a dynamic pricing rule. See [Dynamic Fee Split](#tag/pricing_split). The splits apply to that charge only and do not modify the subscription's own declaration. Omit `split_ids` and Glomo prices the charge from the subscription's declaration; if that declaration no longer resolves, the auto debit is rejected with a `400 Bad Request` until you pass a valid `split_ids` to override it.

Endpoint: POST /payment
Version: 1.0.0
Security: JWT

## Request fields (application/json):

  - `order_id` (string)
    The unique identifier for the order. Either `order_id` or `subscription_id` must be provided, but not both.
    Example: order_68c00b7btsthf

  - `subscription_id` (string)
    The unique identifier for the subscription. Either `order_id` or `subscription_id` must be provided, but not both.
    Example: sub_5JU9yv0lGSUP

  - `method` (string)
    Payment method. Must be `card`. Required for initial payments. Not required for subsequent payments (defaults to `card`).
    Enum: "card"

  - `sequence` (string)
    Payment sequence. Use `initial` (default) for first-time payments or `subsequent` for merchant-initiated payments on `as_presented` subscriptions.
    Enum: "initial", "subsequent"

  - `card` (object)
    Card details. Required for initial payments. Not required for subsequent payments — the card from the last successful payment is reused.

  - `card.holder_name` (string, required)
    The name of the card holder.
    Example: John Doe

  - `card.number` (string, required)
    The card number.
    Example: 4111111111111111

  - `card.expiry_month` (string, required)
    The card expiry month (MM format).
    Example: 09

  - `card.expiry_year` (string, required)
    The card expiry year in 2-digit (YY) format. Send the last two digits of the expiry year (e.g. for 2030, send '30').
    Example: 30

  - `card.cvv` (string, required)
    The card CVV/CVC code.
    Example: 123

  - `callback_url` (string)
    HTTPS URL where the customer is redirected after payment processing. Required for initial payments. Not required for subsequent payments as there is no customer redirect involved.
    Example: https://server.yoursite.com/payment/callback

  - `request_id` (string)
    Idempotency key. Required for subsequent payments, optional for initial payments.
    Example: unique_request_id_123

  - `amount` (integer)
    Payment amount in minor units (cents). Required for subsequent subscription payments. Cannot exceed the subscription's `max_amount`.
    Example: 1500

  - `currency` (string)
    Currency code in [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format. Must match the subscription's currency for subsequent payments.
    Example: USD

  - `split_ids` (array)
    The pricing splits to apply to this charge. Supported on a `subsequent` auto debit for an `as_presented` subscription; sending `split_ids` for a fixed-frequency subscription returns a `400 Bad Request`.
The splits apply to this charge only. They override the subscription's own declaration for this charge and do not modify it. Omit `split_ids` and Glomo prices the charge from the subscription's declaration.
    Example: ["psplit_7Kq2mXbTdLp9"]

## Response 201 fields (application/json):

  - `payment_id` (string)
    The unique identifier for the created payment.
    Example: payt_691eeb9aV79Uk

  - `status` (string)
    The current status of the payment.
    Enum: "pending", "success", "failed", "action_required", "in_progress", "under_review"

  - `next_steps` (array)
    A list of actions to be taken to complete the payment. For initial payments, this typically includes a redirect URL for 3DS/OTP authentication and a polling URL to check payment status.

  - `next_steps.action` (string)
    The type of action to perform.
    Enum: "redirect", "poll"

  - `next_steps.payload` (object)
    The payload for the action. Structure varies based on the action type.

  - `next_steps.payload.url` (string)
    The URL for the action. For `redirect`, this is the URL to redirect the customer to. For `poll`, this is the URL to poll for payment status updates.
    Example: https://secure.glomopay.com?paymentId=payt_691eeb9aV79Uk&authToken=ey...&redirectUrl=encoded_url

  - `next_steps.payload.interval_in_ms` (integer)
    The recommended polling interval in milliseconds. Only present for `poll` actions.
    Example: 5000

## Response 400 fields (application/json):

  - `error` (string)
    Enum: "Bad Request"

  - `message` (string)
    Error message.
    Example: order_id or subscription_id is required

