session/refund
session/refund
Use this request to return money to the user after a successful payment.
After completing the refund, Smart Glocal will send you a payment_refunded
webhook.
Endpoint
api/v1/session/refund
Request parameters
Name | Mandatory | Type | Description |
---|---|---|---|
session_id | + | string | Identifier of the session with the successful payment that needs to be refunded |
amount_details | - | object | Amount of the refund. If not specified, the refund will be made for the full amount of the payment |
metadata | - | * | Additional information |
Request example
curl -X POST \
https://demo.smart-glocal.com/api/v1/session/refund \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: signature' \
-d '{
"session_id":"ps_3230"
}'
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": "in_progress",
"created_at": "2024-05-27T02:03:00.000000Z",
"updated_at": "2024-05-27T02:03:00.000000Z",
"acquiring_payments": [
{
"id": "pm_2705",
"status": "succeeded",
"created_at": "2024-05-27T02:03:00.000000Z",
"finished_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"
},
"refunds": [
{
"id": "rf_23",
"status": "in_progress",
"created_at": "2024-05-27T02:03:00.000000Z",
"amount_details": {
"amount": 10000,
"currency": "usd"
}
}
]
}
]
}
}
Unsuccessful response example
{
"error": {
"code": "error code",
"description": "error description"
},
"status": "error"
}