session/init/payment
session/init/payment
This request is used to simultaneously create a session and start a payment if you are ready to pass all the parameters needed for the payment.
The response contains the parameters of the session created and information on the payment (AcquiringPayment).
If you decide to use this method, please use an idempotency key.
Endpoint
api/v1/session/init/payment
Request parameters
Name | Mandatory | Type | Description |
---|---|---|---|
payment_details | + | PaymentDetails | Payment data |
amount_details | + | AmountDetails | Amount. Transmitted in the USD decimal format. If you are sending 100 USD, you will need to specify 10000 |
participant_details | - | ParticipantDetails | Information on the sender and recipient |
customer | + | Customer | Recipient's data in your system |
payment_options | - | PaymentOptions | Additional payment parameters |
metadata | - | * | Additional information. Any data you need in order to perform the operation. Returned in responses and webhooks |
Request example
curl -X POST \
https://demo.smart-glocal.com/api/v1/session/init/payment \
-H 'content-type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: signature' \
-d '{
"payment_details": {
"type": "card",
"card": {
"type": "bank_card",
"bank_card": {
"number": "4242424242424242",
"expiration_month": "05",
"expiration_year": "25",
"security_code": "123"
}
}
},
"amount_details": {
"amount": 10000,
"currency": "usd"
},
"customer": {
"reference": "lucky"
},
"payment_options": {
"return_url": "https://website.com"
}
}'
Response parameters
Name | Mandatory | Type | Description |
---|---|---|---|
status | + | string | Status. Options: error , ok |
session | - | PaymentSession | Payment session |
error | - | Error | Error |
Successful response example
{
"status": "ok",
"session": {
"id": "ps_3230",
"status": "in_progress",
"created_at": "2024-05-27T02:03:00.000000Z",
"updated_at": "2024-05-27T02:03:00.000000Z",
"acquiring_payments": [
{
"id": "pm_203",
"status": "in_progress",
"created_at": "2024-05-27T02:03:00.000000Z",
"customer": {
"reference": "lucky"
},
"payment_details": {
"type": "card",
"card": {
"brand": "visa",
"last4": "4242"
}
},
"amount_details": {
"amount": 10000,
"currency": "usd"
},
"payment_options": {
"return_url": "https://website.com"
}
}
]
}
}
Unsuccessful response example
{
"error": {
"code": "error code",
"description": "error description"
},
"status": "error"
}