Payments without a payment form
Attention: This page is outdated! Please go to the payments section.
This scenario describes how bank card payments are accepted and processed by services having the technical capacity to collect and store card details on their side.
A payment with delayed capture will be soon described separately. You can skip this step.
Step 1. Create a payment session
Send a request for session creation (session/create
). You will receive the payment session identifier in response. You can perform several actions within a single session: for example, you can accept and then refund a payment.
Request headers should be used to pass your project identifier and the request's signature.
Request example: session creation
DOCUSAURUS_CODE_TABS
cURL
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"
}'
END_DOCUSAURUS_CODE_TABS
Step 2. Initiate a payment
Send a request to perform a payment using the session/start/payment
method (this method works if a session has been created). In the session_id
parameter, pass the identifier of the session created in step 1. In the payment_details.type
field, specify card
. In the card
object, transmit user's bank card details.
Request example
DOCUSAURUS_CODE_TABS
cURL
curl -X POST \
https://demo.smart-glocal.com/api/v1/session/start \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: e05794ee22f47ee5f674e63303ea227e6113f42359f332945304f1e958542fff' \
-d '{
"session_id": "3230",
"payment_details": {
"type": "card",
"card": {
"number": "4242424242424242",
"expiration_month":"12",
"expiration_year":"22",
"security_code":"123",
"cardholder_name":"John Doe"
}
},
"customer": {
"reference": "lucky"
},
"metadata": "good"
}'
END_DOCUSAURUS_CODE_TABS
Step 3. Wait for notification that Smart Glocal is ready to perform the payment
Smart Glocal will send you a ready_to_confirm
webhook. This means that the payment can be performed and Smart Glocal is waiting for you to confirm (or cancel).
The webhook body will contain all the data needed for the payment, which you need to check.
You then reply with the 200 HTTP code.
Webhook example
DOCUSAURUS_CODE_TABS
cURL
curl -X POST \
https://partner.com \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-SIGN: a4f1698616d6ad7b8b73a9d72d281eeb443b64dee3f38df430eeed6aa29e1dc' \
-d '{
"type": "ready_to_confirm",
"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_2018",
"status": "pending",
"created_at": "2024-05-27T02:03:00.000000Z",
"customer": {
"reference": "user123",
"contacts": [
{
"email": "user@gmail.com"
}
]
},
"payment_details": {
"type": "card",
"card": {
"last4": "4242",
"brand": "visa"
}
},
"amount_details": {
"amount": 10000,
"currency": "usd"
},
"metadata": "good"
}
]
}
}'
END_DOCUSAURUS_CODE_TABS
Step 4. Confirm or cancel the payment
Check the payment details and confirm that you are ready to perform the payment (sending a session/confirm
request) or cancel it (sending a session/cancel
request).
Request example
DOCUSAURUS_CODE_TABS
cURL
curl -X POST \
https://demo.smart-glocal.com/api/v1/session/confirm \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: 6eaf1e9cfa15f011e02c0a126187fe327a71e9d79be5e3fdb3f69dc5dfcd9872' \
-d '{
"session_id": "3230"
}'
END_DOCUSAURUS_CODE_TABS
Request example: session/cancel
DOCUSAURUS_CODE_TABS
cURL
curl -X POST \
https://demo.smart-glocal.com/api/v1/session/cancel \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: 6eaf1e9cfa15f011e02c0a126187fe327a71e9d79be5e3fdb3f69dc5dfcd9872' \
-d '{
"session_id": "3230"
}'
END_DOCUSAURUS_CODE_TABS
Step 5. Lead the user through 3D Secure
If the user's card requires 3D Secure, Smart Glocal will send you an action_required
webhook with redirection details. Redirect the user to the address that will be specified in the customer_interaction.redirect.url
field.
Webhook example
DOCUSAURUS_CODE_TABS
cURL
curl -X POST \
https://partner.com \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-SIGN: a4f1698616d6ad7b8b73a9d72d281eeb443b64dee3f38df430eeed6aa29e1dc' \
-d '{
"type": "action_required",
"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_2018",
"status": "pending",
"created_at": "2024-05-27T02:03:00.000000Z",
"customer": {
"reference":"user@SG.com"
},
"payment_details": {
"type": "card",
"card": {
"brand": "visa",
"last4": "8801"
}
},
"amount_details": {
"amount": 15000,
"currency": "usd"
},
"customer_interaction": {
"type": "redirect",
"redirect": {
"url": "https://website.com?foo=bar",
"base_url": "https://website.com"
"method": "POST",
"qs": {
"foo": "bar"
},
"params": {
"paReq": "sdfew^//asdhbv",
"MD": "abc75daefnn"
}
}
}
}]
}
}
}'
END_DOCUSAURUS_CODE_TABS
Step 6. Wait for a ready_to_capture
webhook
Through the ready_to_capture
webhook, Smart Glocal informs you that the payment amount has successfully been put on hold on the user's bank card.
Webhook example
DOCUSAURUS_CODE_TABS
cURL
curl -X POST \
https://partner.com \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-SIGN: a4f1698616d6ad7b8b73a9d72d281eeb443b64dee3f38df430eeed6aa29e1dc' \
-d '{
"type": "ready_to_capture",
"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_2018",
"status": "pending",
"created_at": "2024-05-27T02:03:00.000000Z",
"customer": {
"reference": "user123",
"contacts": [
{
"email": "user@gmail.com"
}
]
},
"payment_details": {
"type": "card",
"card": {
"last4": "4242",
"brand": "visa"
}
},
"amount_details": {
"amount": 10000,
"currency": "usd"
},
"metadata": "good"
}
]
}
}'
END_DOCUSAURUS_CODE_TABS
Step 7. Proceed with debiting, or cancel
Debit the amount put on hold (session/capture
) or cancel the capture (session/cancel
).
Request example: capture_request
DOCUSAURUS_CODE_TABS
cURL
curl -X POST \
https://demo.smart-glocal.com/api/v1/session/capture \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: 6eaf1e9cfa15f011e02c0a126187fe327a71e9d79be5e3fdb3f69dc5dfcd9872' \
-d '{
"session_id": "3230"
}'
END_DOCUSAURUS_CODE_TABS
Request example: cancel_request
DOCUSAURUS_CODE_TABS
cURL
curl -X POST \
https://demo.smart-glocal.com/api/v1/session/cancel \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: 6eaf1e9cfa15f011e02c0a126187fe327a71e9d79be5e3fdb3f69dc5dfcd9872' \
-d '{
"session_id": "3230"
}'
END_DOCUSAURUS_CODE_TABS
Step 8. Learn the payment result
Wait for a payment_finished
webhook or request the payment status using the session/status
method.
The result of the payment can be found in the payment.status
field.
If the status is succeeded
, then the payment has been successful. If the status is failed
, then the payment has not been completed because of an error.