session/create
session/create
This request creates 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.
The response contains the parameters of the session created.
Endpoint
api/v1/session/create
Request parameters
Name | Mandatory | Type | Description |
---|---|---|---|
payment_method | - | PaymentMethod | Payout details (card, customer account, etc.) |
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 | Mandatory for payments | 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 |
If you do not specify
payment_method
(for payouts)/payment_details
(for payments),customer
(for payments), andamount_details
(for payouts and 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: 721af394d5a7aefd0e91f5390abc4d7e20fb2b5784b091fef621f3c61b7abb4b' \
-d '{
"amount_details": {
"amount": 10000,
"currency": "usd"
},
"metadata": "order123"
}'
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": "3230",
"status": "created",
"created_at": "2018-05-27T02:03:00.000000Z",
"updated_at": "2018-05-27T02:03:00.000000Z",
}
}
Unsuccessful response example
{
"error": {
"code": "error code",
"description": "error description"
},
"status": "error"
}