Payouts to cards
You can make a payout to a card following one of two scenarios described below.
All API operations are carried out within a payment session. One payment session can include several operations: for example, you can accept and then refund a payment.
- You are passing card details with open parameters
- You are using our payment widget
To create a payout, complete the following steps:
-
Create a payment session sending a
session/create
request.Alternatively, you can use the session/init/payout method. In this case, specify all the payout parameters right away and skip the next step.
-
Send a
session/start/payout
request to start the payout.Example
curl -X POST \
https://demo.smart-glocal.com/api/v1/session/start/payout \
-H 'content-type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: signature' \
-d '{
"session_id": "3230"
"payment_method": {
"type": "card",
"card": {
"last4": "4242",
"brand": "visa"
}
},
"amount_details": {
"amount": 10000,
"currency": "usd"
},
"customer": {
"reference": "user123",
"contacts": [
{
"email": "user@gmail.com"
}
]
},
"metadata": "good"
}' -
Wait for a
ready_to_confirm
webhook. When you receive it, it means that Smart Glocal is ready to make the payout and is waiting for your confirmation. -
Send a
session/confirm
request or asession/cancel
request to confirm or cancel the operation. -
Wait for a
payment_finished
webhook containing the result of the payout. If the status issucceeded
, the payout was successful. To learn more about the payout statuses, see here.
Sequence diagram of payouts without use of the payment form
To create a payout using our widget, complete the following steps:
-
Complete Steps 1-5.
-
Create a payment session sending a
session/create
request.Alternatively, you can use the session-init-payout method. In this case, specify all the payout parameters right away as it is specified in the next step.
-
Send a
session/start/payout
request to start the payout.In the
EncryptedCard
object, pass the tokenized bank card details obtained from the widget.Example
curl -X POST \
https://demo.smart-glocal.com/api/v1/session/start/payout \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: signature' \
-d '{
"session_id": "3230",
"payment_method": {
"type": "card",
"card": {
"type": "encrypted_card",
"encrypted_card": {
"number_hash": "63191fa17cc7edf818ee5d6611a2c2169ab30b705111cffd710af39880deef09",
"expiration_date_hash":"f4286b9a8e0eb7974f34a996ee732fd861868f2fc7aaa7ed5cca8de2489534ad",
"cardholder_name_hash":"dd6cce1e06790019dd266c6f70430f87dd378df802c6b7494395156f62533ce6",
"security_code_hash":"7756b897e88c035f34c6658a147e263b29b480a5cdf76581012ff10ede478c4c"
}
}
},
"metadata": "good"
}'To find information on the token or card, use the
token/info
method. This method also returns the last 4 numbers of the card, so that you can show the user where the amount is going. -
Wait for a
ready_to_confirm
webhook. When you received it, it means that Smart Glocal is ready to make the payout and is waiting for your confirmation. -
Send a
session/confirm
request or asession/cancel
request to confirm or cancel the operation. -
Wait for a
payment_finished
webhook containing the result of the payout. If the status issucceeded
, the payout was successful. To learn more about the payout statuses, see here.