Payment
1. Create payment intent
Endpoint
POST /api/v1/shop/orders/{orderId}/payment-intent
Request Headers
{
"Authorization": "Bearer token here",
"X-API-Key": "123456789",
"Content-Type": "application/json"
}
Response Body (200)
{
"message": "Payment intent created successfully",
"data": {
"id": "pi_3R8f5yQ9LjHruSyq1ofjdVY5",
"client_secret": "pi_3R8f5yQ9LjHruSyq1ofjdVY5_secret_wWSgKgsyjo6WRpCf1aXJN3zRw",
"amount": "112.00",
"currency": "usd",
"status": "requires_payment_method",
"line_items": [
{
"name": "Main product 2",
"amount": 5600,
"currency": "usd",
"quantity": 2,
"description": ""
}
]
}
}
2. For testing backend only! Make payment
Endpoint
POST https://api.stripe.com/v1/payment_intents/{stripePaymentId}
Request Headers
{
"Authorization": "Stripe secret key",
"Content-Type": "application/json"
}
Response Body (200)
{
"id": "pi_3R8f5yQ9LjHruSyq1ofjdVY5",
"object": "payment_intent",
"amount": 11200,
"amount_capturable": 0,
"amount_details": {
"tip": {}
},
"amount_received": 0,
"application": null,
"application_fee_amount": null,
"automatic_payment_methods": null,
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic_async",
"client_secret": "pi_3R8f5yQ9LjHruSyq1ofjdVY5_secret_wWSgKgsyjo6WRpCf1aXJN3zRw",
"confirmation_method": "automatic",
"created": 1743415050,
"currency": "usd",
"customer": null,
"description": "Payment for Order #ORD-20250331-5XZF",
"invoice": null,
"last_payment_error": null,
"latest_charge": null,
"livemode": false,
"metadata": {
"line_items": "[{\"name\":\"Main product 2\",\"amount\":5600,\"currency\":\"usd\",\"quantity\":2,\"description\":\"\"}]",
"order_id": "9",
"order_number": "ORD-20250331-5XZF"
},
"next_action": null,
"on_behalf_of": null,
"payment_method": "pm_1R8f7mQ9LjHruSyqZP0sUF3N",
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
"installments": null,
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"processing": null,
"receipt_email": "[email protected]",
"review": null,
"setup_future_usage": null,
"shipping": null,
"source": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "requires_confirmation",
"transfer_data": null,
"transfer_group": null
}
3. Mark order as paid. This endpoint will be call in payment system
Endpoint
POST /api/v1/shop/orders/{orderId}/payment
Request Headers
{
"X-API-Key": "123456789",
"Content-Type": "application/json"
}
Response Body (200)
{
"message": "Payment intent created successfully",
"data": {
"id": "pi_3R8f5yQ9LjHruSyq1ofjdVY5",
"client_secret": "pi_3R8f5yQ9LjHruSyq1ofjdVY5_secret_wWSgKgsyjo6WRpCf1aXJN3zRw",
"amount": "112.00",
"currency": "usd",
"status": "requires_payment_method",
"line_items": [
{
"name": "Main product 2",
"amount": 5600,
"currency": "usd",
"quantity": 2,
"description": ""
}
]
}
}
31 March 2025