# Create a customer's payment

`POST /v1/platforms/{platformOrgId}/customers/{customerOrgId}/payments`

**Create a payment** (Act as a platform). Sends money from one of those accounts to a recipient. The amount plus the fee is reserved immediately. Above the approval threshold the status is `pending_approval`.

Prerequisite: Permission `platform:customer_operate`, a new `Idempotency-Key`, `account_id`, `external_account_id`, and a `rail` from the quote or a `policy`. The customer is `active`.

Acts on a linked customer with the platform's own key or team (platform:customer_operate). Same as POST /v1/orgs/{orgId}/payments. Sends money to a recipient. The amount plus fee is reserved immediately; payments above the approval threshold wait for approvers. Requires two-factor authentication. Retrying with the same Idempotency-Key returns the original payment.

When to use it: Paying a recipient from the customer's account with your platform key. Send a new Idempotency-Key.

Requires: organization platform, customer active; permission platform:customer_operate

## Request body

- `account_id` (string (uuid), required): Payezy account to send from. Use an id from list accounts.
- `external_account_id` (string (uuid), required): The recipient's bank account or wallet
- `amount` (string, required): How much to send, as a decimal string in major units. The fee from the quote is reserved on top of this.
- `asset` (enum): Stablecoin to deliver to a wallet (default USDC) One of USDC, SBC.
- `rail` (enum): Rail to use. Take it from the quote. Omit it and set policy to let Payezy choose. One of: ach_credit, same_day_ach_credit, wire, fednow_credit, onchain. One of ach_credit, same_day_ach_credit, wire, fednow_credit, onchain.
- `policy` (enum): cheapest picks the lowest fee. fastest picks the earliest arrival. Ignored when rail is set. One of: cheapest, fastest. One of cheapest, fastest.
- `memo` (string): Note that travels with the payment, up to 140 characters.
- `invoice_number` (string): The invoice or bill this payment settles

```json
{
  "account_id": "a4d2f7b9-1c3e-4a58-8f20-6b9e3d1c7a05",
  "external_account_id": "e93b1d60-2f8a-4c7e-91d4-3a6b5c0f2e18",
  "amount": "1250.00",
  "asset": "USDC",
  "rail": "ach_credit",
  "policy": "cheapest",
  "memo": "Invoice 1042",
  "invoice_number": "1042"
}
```

Events: payment.updated

Errors: own_account, insufficient_funds, recipient_blocked, recipient_under_review, single_payout_limit, daily_payout_limit, above_ceiling, idempotency_key_reused, org_restricted, invalid_rail

```bash
curl -X POST "https://sandbox-api.payezy.io/v1/platforms/$PLATFORM_ORG_ID/customers/$CUSTOMER_ORG_ID/payments" \
  -H "Authorization: Bearer $PAYEZY_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "account_id": "a4d2f7b9-1c3e-4a58-8f20-6b9e3d1c7a05",
  "external_account_id": "e93b1d60-2f8a-4c7e-91d4-3a6b5c0f2e18",
  "amount": "1250.00",
  "asset": "USDC",
  "rail": "ach_credit",
  "policy": "cheapest",
  "memo": "Invoice 1042",
  "invoice_number": "1042"
}'
```
