session/create
session/create
Send this request to create a payment session on Smart Glocal's side.
Payment operations can only be performed within a session. One or more operations of the same or different types can be performed within a session (e.g. several payouts, a payment and a refund, or a payment which is subsequently split).
Use this request if you need to request data necessary to perform a payout or a payment from the user. For example, call the tokenization widget, show it to the user and get tokenized card details, and then send the payout request with those details.
If you are ready to pass the payout/payment parameters right away, you can do so:
For payments, pass payment_details
, amount_details
, and customer
.
For payouts, pass payment_method
and amount_details
.
The response contains the parameters of a session created.
Endpoint
api/v1/session/create
Request parameters
Name | Mandatory | Type | Description |
---|---|---|---|
payment_method | - | object | Payout details |
payment_details | - | object | Payment details |
amount_details | - | object | Amount in the USD decimal format. To send 100 USD, specify 10000 |
participant_details | - | object | Information on the sender and recipient |
customer | - | object | Recipient's data in your system |
payment_options | - | object | Additional payment parameters |
metadata | - | * | Additional information. Any data you need in order to perform the operation. Returned in responses and webhooks |
If you do not specify
payment_method
andamount_details
for payouts/payment_details
,customer
, andamount_details
for payments in this request, make sure you specify them in yoursession/start/payment
orsession/start/payout
request, respectively.
Request example
curl -X POST \
https://demo.smart-glocal.com/api/v1/session/create \
-H 'content-type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: signature' \
-d '{
"amount_details": {
"amount": 10000,
"currency": "usd"
},
"metadata": "order123"
}'
Response parameters
Name | Mandatory | Type | Description |
---|---|---|---|
status | + | string | Status. Options: error , ok |
session | - | object | Payment session |
error | - | object | Error description |
Successful response example
{
"status": "ok",
"session": {
"id": "ps_3230",
"status": "created",
"created_at": "2024-05-27T02:03:00.000000Z",
"updated_at": "2024-05-27T02:03:00.000000Z",
}
}
Unsuccessful response example
{
"error": {
"code": "error code",
"description": "error description"
},
"status": "error"
}