Confirm Subscription
Take the first payment for a subscription made with Create Subscription. This is usually called from your checkout page, with your publishable key and the subscription's client_secret.
POST /subscriptions/:subscription_id/confirm
Only a subscription in created status can be confirmed. A second confirm is refused, so the first period cannot be charged twice.
Headers
| Header | Type | Required | Description |
|---|---|---|---|
api-key | string | Yes | Your publishable key when called from a browser, or your secret API key from a server. |
X-Profile-Id | string | No | Not needed: the subscription's own profile is used. If you send it, it must be that profile, otherwise the request fails with IR_37 (subscription not found). |
Path Parameters
| Parameter | Type | Description |
|---|---|---|
subscription_id | string | Required. ID of the subscription to confirm. |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
client_secret | string | With a publishable key | The client_secret returned when the subscription was created. It must belong to the subscription in the path. Send it only with your publishable key; a request with your secret API key must not include it. |
payment_details | object | Yes | The card to charge. See Payment details. |
Payment details
| Field | Type | Required | Description |
|---|---|---|---|
payment_method | string | Yes | card. |
payment_method_type | string | No | credit or debit. |
payment_method_data | object | Yes* | The card: card_number, card_exp_month, card_exp_year, card_holder_name, card_cvc. |
payment_token | string | Yes* | A payment method token, instead of payment_method_data. |
customer_acceptance | object | With a new card | Record of the customer agreeing to future charges: acceptance_type (online), accepted_at, and online.ip_address and online.user_agent. |
browser_info | object | No | Browser details for 3D Secure and fraud checks. |
billing | object | No | Billing address. |
shipping | object | No | Shipping address. |
* Send either payment_method_data (a new card) or payment_token (a card the customer already saved). With payment_method_data, customer_acceptance is required: without it the card is not saved and no renewal could be charged.
Request Example
curl -X POST 'https://api.moonlinkpay.com/subscriptions/sub_fOC8OiljkGOI59gaZJqL/confirm' \ -H "Content-Type: application/json" \ -H "api-key: pk_snd_YOUR_PUBLISHABLE_KEY" \ -d '{ "client_secret": "sub_fOC8OiljkGOI59gaZJqL_secret_rGax6h0aEyu8owBeID6C", "payment_details": { "payment_method": "card", "payment_method_type": "credit", "payment_method_data": { "card": { "card_number": "4242424242424242", "card_exp_month": "12", "card_exp_year": "30", "card_holder_name": "Jane Doe", "card_cvc": "123" } }, "customer_acceptance": { "acceptance_type": "online", "accepted_at": "2026-11-03T10:00:00Z", "online": { "ip_address": "203.0.113.10", "user_agent": "Mozilla/5.0" } } }}'Response
The response has the same shape as Create and Confirm Subscription.
{"id": "sub_fOC8OiljkGOI59gaZJqL","merchant_reference_id": "order_1002","status": "active","billing_cycle_count": 0,"next_billing_at": "2026-12-03T18:01:12.513Z","cancel_at_period_end": false,"payment": { "payment_id": "sub_7515eafdcb30ed3ec6e1425c_0_0", "status": "succeeded", "amount": 1500, "currency": "USD", "next_action": null},"invoice": { "id": "invoice_T4UTILxQleMKwGQGkATL", "status": "invoice_paid", "billing_cycle_count": 0}}3D Secure. If status is created and payment.next_action holds a redirect URL, send the customer there. After they complete the challenge, the subscription becomes active within a few seconds and you receive invoice_paid.
Errors
| Code | When |
|---|---|
IR_37 | No subscription with this ID on your account, or X-Profile-Id names a different profile than the subscription's. |
IR_06 | The subscription is not in created status, client_secret belongs to a different subscription, client_secret was sent with a secret API key, or new card details were sent without customer_acceptance. |
A declined payment returns the subscription with status: "failed". Create a new subscription to try again.