---
title: "Auto Charge On Demand"
method: POST
path: "/api/v2/payments/auto-charge-on-demand/{payment_id}"
tags: ["Payments"]
---

# Auto Charge On Demand

`POST /api/v2/payments/auto-charge-on-demand/{payment_id}`

## Request

- Base URL: `https://stream-app-service.streampay.sa`
- URL: `https://stream-app-service.streampay.sa/api/v2/payments/auto-charge-on-demand/{payment_id}`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Charge a payment using the consumer's latest tokenized card.

This endpoint allows organizations to charge a payment using the consumer's latest
active tokenized card. The following conditions must be met:

- The consumer must have at least one active tokenized card.
- The payment must be in an unpaid status (PENDING, PROCESSING, FAILED, etc.).

**This is a restricted API and is only available to some organizations.**

## Path parameters

- `payment_id` string, uuid, required: Unique identifier (UUID) of the payment to charge

## Response `200`

Successful Response

- AutoChargeOnDemandResponse
  - `payment_id` string, uuid: ID of the payment that was charged
  - `invoice_id` string, uuid: ID of the invoice associated with the payment

## Other responses

- `400`: If no active card exists, payment is already paid, or payment processing fails.
- `401`: If the organization does not have access to this API.
- `404`: If payment, consumer, card, or consent is not found.
- `422`: Validation Error

---

[API](https://skmtc.dev/streampay/apis/stream-app.md) - [All operations](https://skmtc.dev/streampay/apis/stream-app/llms.txt) - [OpenAPI document](https://skmtc.dev/streampay/apis/stream-app/revisions/9c73cbd109e4?raw)
