Checkout
POST
/checkoutsCreate Checkout Session
Body — 1:1 with CreateCheckoutSessionDTO (app/handlers/v1/checkout_session/request.go).
A checkout is created for a collection target (target_type + target_id) — an invoice or a payment_intent, identical convention to POST /payment_links. Amount, currency, customer, transfer destination and allowed methods are derived from the target — no provider/payment method is chosen here. Returns { id, url, session, status }; share url with the customer.
| Field | Required | Notes |
|---|---|---|
target_type | ✓ | invoice or payment_intent |
target_id | ✓ | id of the target to collect |
success_url | optional | redirect after payment |
cancel_url | optional | redirect on cancel |
metadata | optional | free-form |
Request
Example
curl -X POST 'https://api.paycose.com/api/v1/app1/platform/wallet/checkouts/' \
-H 'X-Session-Token: {{session_token}}' \
-H 'X-Country: {{country}}' \
-d '{
"mode": "<string>",
"target_type": "invoice",
"target_id": "{{invoice_id}}",
"line_items": [
{
"price": "<string>",
"quantity": 0
}
],
"subscription_data": {
"customer_id": "<string>",
"currency": "<string>",
"trial_period_days": 0,
"trial_end": "<RFC3339 timestamp>",
"description": "<string>",
"coupon": "<string>",
"default_tax_rates": [
"<string>"
],
"default_fees": [
"<string>"
],
"billing_cycle_anchor": "<RFC3339 timestamp>",
"collection_method": "<string>",
"payment_settings": {
"save_default_payment_method": "<string>"
},
"metadata": {}
},
"success_url": "https://example.com/thanks",
"cancel_url": "https://example.com/cart",
"allow_promotion_codes": false,
"promotion_code": "<string>",
"payment_method_types": [
"<string>"
],
"payment_method_collection": "<string>",
"metadata": {}
}'Headers
| Name | Value |
|---|---|
| X-Session-Token | {{session_token}} |
| X-Country | {{country}} |
Body
| Name | Type | Value |
|---|---|---|
| mode | string | <string> |
| target_type | string | invoice |
| target_id | string | {{invoice_id}} |
| line_items | array | [1] |
| subscription_data | object | {…} |
| success_url | string | https://example.com/thanks |
| cancel_url | string | https://example.com/cart |
| allow_promotion_codes | boolean | false |
| promotion_code | string | <string> |
| payment_method_types | array | [1] |
| payment_method_collection | string | <string> |
| metadata | object | {…} |
{
"mode": "<string>",
"target_type": "invoice",
"target_id": "{{invoice_id}}",
"line_items": [
{
"price": "<string>",
"quantity": 0
}
],
"subscription_data": {
"customer_id": "<string>",
"currency": "<string>",
"trial_period_days": 0,
"trial_end": "<RFC3339 timestamp>",
"description": "<string>",
"coupon": "<string>",
"default_tax_rates": [
"<string>"
],
"default_fees": [
"<string>"
],
"billing_cycle_anchor": "<RFC3339 timestamp>",
"collection_method": "<string>",
"payment_settings": {
"save_default_payment_method": "<string>"
},
"metadata": {}
},
"success_url": "https://example.com/thanks",
"cancel_url": "https://example.com/cart",
"allow_promotion_codes": false,
"promotion_code": "<string>",
"payment_method_types": [
"<string>"
],
"payment_method_collection": "<string>",
"metadata": {}
}Responses
400400 Bad Request
Headers
| Name | Value |
|---|---|
| Content-Type | application/json |
Body
{
"object": "error",
"code": "<string>",
"key": "<string>",
"i18n_key": "<string>",
"message": "<string>",
"request_id": "<string>"
}500500 Internal Server Error
Headers
| Name | Value |
|---|---|
| Content-Type | application/json |
Body
{
"object": "error",
"code": "<string>",
"key": "<string>",
"i18n_key": "<string>",
"message": "<string>",
"request_id": "<string>"
}