Payout to a bank card
This scenario describes how to perform a payout to a bank card if you decided to obtain and store bank card details on your side (you must comply with the additional PCI DSS requirements).
In this case, you have two options:
- create a payment session and perform the payout with a single request
- create a payment session first, and then perform the payout
Below is a description of the recommended option, the one that involves creating a session separately.
Payout to a card, with a session created separately
Step 1. Create a payment session
Create a session using the session/create method. You will
receive the payment session identifier in response.
Learn more about payment sessions
Use the request headers to pass your project identifier and the request's signature.
Learn more about the request format
Example of a session creation request
curl -X POST \
https://proxy-demo.pikepayments.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": "rub"
},
"metadata": "order123"
}'
Step 2. Start the payout
Start the payout using the session/start/payout method.
- In the
session_idparameter, pass the identifier of the session created in Step 1. - In the
typeparameter of thepayment_method/payout_detailsobject, passcard. - In the
bank_cardobject, pass the recipient's bank card details.
Request example
curl -X POST \
https://proxy-demo.pikepayments.com/api/v1/session/start \
-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": "bank_card",
"bank_card": {
"number": "4242424242424242"
}
}
},
"participant_details": {
"recipient": {
"full_name": "Ivanov Ivan"
}
},
"metadata": "good"
}'
Step 3. Wait for a notification that Pike is ready to perform the payout
Pike will send you a ready_to_confirm webhook. This means that the payout can be performed and Pike is waiting for you to confirm (or cancel). The webhook body will contain
all the details of the payout.
Reply with the 200 HTTP code.
Webhook example
curl -X POST \
https://partner.ru \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-SIGN: signature' \
-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",
"next_action": "confirm",
"payments": [{
"id": "po_1234",
"status": "pending",
"created_at": "2024-05-27T02:03:00.000000Z",
"customer": {
"reference": "user",
"contacts": [{
"email": "user@gmail.com"
}]
},
"payment_method": {
"type": "card",
"card": {
"last4": "4242",
"brand": "visa"
}
},
"amount_details": {
"amount": 10000,
"currency": "rub"
},
"metadata": "good"
}]
}
}'
Step 4. Confirm or cancel the payout
Check the payout details and confirm that you are ready to perform the
payout (using the
session/confirm
request) or cancel it
(using the session/cancel).
Examples
- Confirming the payout
- Canceling the payout
curl -X POST \
https://proxy-demo.pikepayments.com/api/v1/session/confirm \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: signature' \
-d '{
"session_id": "3230"
}'
curl -X POST \
https://proxy-demo.pikepayments.com/api/v1/session/cancel \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: signature' \
-d '{
"session_id": "3230"
}'
Step 5. Wait to be notified of the results of the payout
Pike will send you a payment_finished webhook.
The webhook body will contain all the details of the payout. The result
of the payout can be found in the status field of the payments/payout_list array.
If the status is succeeded, then the payout was successful.
Learn more about the payout statuses