Payments

Create a payment

Create an online or offline payment for an invoice, order, payment request, or credit grant.

POST
/payments

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

mode*string

Mode of the payment. Offline payments record manual payments made outside of the system. Online payments process payments through a payment provider.

Default"offline"
Value in"online" | "offline"
account_id*string

ID of the account to record payment for.

reference_id*string

Reference for the payment.

succeeded_at?string

For offline payments only. Timestamp when the payment succeeded. Defaults to current time if not provided.

Formatdate-time
integration_id?string

ID of the payment integration to process the payment through. Required for online payments when payment_method_id is not provided.

payment_method_id?string

ID of the payment method to use for the payment. Payment method will be charged immediately. Required for online payments when integration_id is not provided.

invoice_id?string

ID of the invoice to create payment for. Required when payment_request_id, order_id and credit_grant_id are not provided.

payment_request_id?string

ID of the payment request to create payment for. Required when invoice_id, order_id and credit_grant_id are not provided.

order_id?string

ID of the order to create payment for. Required when invoice_id, payment_request_id and credit_grant_id are not provided.

credit_grant_id?string

ID of the credit grant to create payment for. Required when invoice_id, payment_request_id and order_id are not provided.

Response Body

application/json

curl -X POST "https://api.sandbox.billingrails.com/v1/payments" \  -H "Content-Type: application/json" \  -d '{    "mode": "offline",    "account_id": "acc_IhMUl3rrZ3",    "reference_id": "PAY-REF-001",    "invoice_id": "inv_IhMUl3rrZ3"  }'
{
  "payment": {
    "object": "payment",
    "id": "pay_IhMUl3rrZ3",
    "account_id": "acc_IhMUl3rrZ3",
    "amount": 1000,
    "currency": "USD",
    "description": "Payment for invoice INV-0001",
    "reference_id": "PAY-REF-001",
    "status": "succeeded",
    "created_at": "2025-02-14T17:33:40.843Z"
  },
  "payment_link": "http://example.com"
}