Create a payment
POST
/v1/payments
const url = 'http://localhost:4000/v1/payments';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"amount":15000,"currency":"XOF","provider":"wave","description":"example","client_reference":"example","customer":{"phone":"+221771234567","name":"example"},"success_url":"https://example.com","cancel_url":"https://example.com","metadata":{"additionalProperty":"example"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:4000/v1/payments \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "amount": 15000, "currency": "XOF", "provider": "wave", "description": "example", "client_reference": "example", "customer": { "phone": "+221771234567", "name": "example" }, "success_url": "https://example.com", "cancel_url": "https://example.com", "metadata": { "additionalProperty": "example" } }'Returns a hosted checkout_url. If provider is set, next_action is ready immediately.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters”idempotency-key
Retry-safe key; reuse it when retrying the same request
string
Retry-safe key; reuse it when retrying the same request
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
amount
required
Integer XOF
integer
Example
15000currency
string
provider
Skip the hosted method picker and start this provider immediately
string
description
string
client_reference
Your order id
string
customer
object
phone
string
Example
+221771234567name
string
success_url
string format: uri
cancel_url
string format: uri
metadata
object
key
additional properties
string
Responses
Section titled “ Responses ”Payment created
Media typeapplication/json
object
id
required
string
object
required
string
livemode
required
boolean
amount
required
integer
currency
required
string
fee
required
integer
net
required
integer
status
required
string
provider
required
string | null
client_reference
required
string | null
description
required
string | null
customer
required
object
phone
required
string | null
name
required
string | null
checkout_url
required
Hosted checkout page — redirect your customer here
string
next_action
required
metadata
required
object
key
additional properties
string
failure_reason
required
string | null
provider_transaction_id
required
string | null
expires_at
required
string
succeeded_at
required
string | null
created_at
required
string
Example
{ "id": "pay_3k9x0c1v2b3n4m5l6k7j", "object": "payment", "status": "requires_payment_method", "provider": "wave", "next_action": { "type": "redirect" }}Validation error
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
details
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example" }}Authentication error
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
details
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example" }}Not found
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
details
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example" }}Rate limited; see Retry-After response header
Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
details
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": "example" }}