Create a payment authorization
How to create a payment authorization via API
To create a new payment authorization, send a POST request to the /api/2026-05/payment_authorizations endpoint, passing the resource arguments in the request body.
Request
POST https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations
Arguments
Body Parameter
Type
Required
type
string
Required
attributes._internal_version
string
Optional
attributes.options
object
Optional
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional
relationships.payment_session
object
Required
Example
The following request creates a new payment authorization:
curl -g -X POST \
'https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer your-access-token' \
-H 'Content-Type: application/vnd.api+json' \
-d '{
"data": {
"type": "payment_authorizations",
"relationships": {
"payment_session": {
"data": {
"type": "payment_sessions",
"id": "ABCRtyUpBa"
}
}
}
}
}'On success, the API responds with a 201 Created status code, returning the created resource object:
{
"data": {
"id": "XAyRWNUzyN",
"type": "payment_authorizations",
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN"
},
"attributes": {
"type": "payment_authorization",
"status": "draft",
"payment_type": "MANUAL",
"token": "xxxx-yyyy-zzzz",
"currency_code": "EUR",
"amount_cents": 1000,
"amount_float": 10.0,
"formatted_amount": "€10,00",
"request_data": {},
"response_data": {},
"options": {
"cancellation_reason": "fraudulent"
},
"requires_action_at": "2018-01-01T12:00:00.000Z",
"processing_at": "2018-01-01T12:00:00.000Z",
"succeeded_at": "2018-01-01T12:00:00.000Z",
"declined_at": "2018-01-01T12:00:00.000Z",
"failed_at": "2018-01-01T12:00:00.000Z",
"canceled_at": "2018-01-01T12:00:00.000Z",
"expired_at": "2018-01-01T12:00:00.000Z",
"created_at": "2018-01-01T12:00:00.000Z",
"updated_at": "2018-01-01T12:00:00.000Z",
"reference": "ANY-EXTERNAL-REFEFERNCE",
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
"metadata": {
"foo": "bar"
},
"capture_balance_cents": 1000,
"capture_balance_float": 10.0,
"formatted_capture_balance": "€10,00",
"void_balance_cents": 1500,
"void_balance_float": 15.0,
"formatted_void_balance": "€15,00",
"next_action_type": "challenge",
"next_action_data": {}
},
"relationships": {
"payment_session": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/relationships/payment_session",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/payment_session"
}
},
"order": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/relationships/order",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/order"
}
},
"payment_setting": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/relationships/payment_setting",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/payment_setting"
}
},
"attachments": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/relationships/attachments",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/attachments"
}
},
"events": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/relationships/events",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/events"
}
},
"event_stores": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/relationships/event_stores",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/event_stores"
}
},
"payment_void": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/relationships/payment_void",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/payment_void"
}
},
"payment_captures": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/relationships/payment_captures",
"related": "https://yourdomain.commercelayer.io/api/2026-05/payment_authorizations/XAyRWNUzyN/payment_captures"
}
}
},
"meta": {
"created_with_version": "2026-05"
}
},
"meta": {
"trace_id": "69abaa3545913c78132e5578bd26208d44aa9043647d78698fd0021f3958cd74",
"api_versions": [
"2026-05"
]
}
}Last updated