Skip to main content

Payout to a bank card with a token

You can use this method if:

  • You already have a tokenized card number.

  • You accept payments, including recurring payments.
    In this case, you can use tokens for recurring payouts.

  • You decided not to store the bank card details that demand compliance with the additional PCI DSS requirements. To start using this method, contact your manager in Pike.

This method does not depend on the project (X-PARTNER-PROJECT in the request header) within which you got the token.

Step 1. Generate a token

If you decided not to store bank card details on your side, use the tokenize/elements method to get a tokenized card number to further use it for payouts.

If you already have a token, skip this step.

Step 2. Create a payment session

Send a session/create request.

Request example
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 '{}'
Response example
  {
"status": "ok",
"session": {
"id": "ps_3230",
"status": "created",
"created_at": "2024-05-27T02:03:00.000000Z",
"updated_at": "2024-05-27T02:03:00.000000Z",
}
}

Step 3. Start the payout

Send a session/start/payout request.

In the request, specify:

  • the session identifier received at the previous step in the request
  • one of the parameters depending on what data you have:

To get token details and the last 4 digits of the tokenized card, use the token/info method.

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": "tokenized_card",
"tokenized_card": {
"token": "759c9852dde2211d7531b3d905c1d513fbfb914bee87fb567d99c7b2f2c2ad44"
}
}
},
"participant_details": {
"recipient": {
"full_name": "Ivanov Ivan"
}
},
"metadata": "good"
}'
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",
"payments": [{
"id": "po_1234",
"status": "in_progress",
"created_at": "2024-05-27T02:03:00.000000Z",
"customer": {
"reference": "user123",
"contacts": [{
"email": "user@gmail.com"
}]
},
"payment_method": {
"type": "card",
"card": {
"type": "tokenized_card",
"tokenized_card": {
"token": "759c9852dde2211d7531b3d905c1d513fbfb914bee87fb567d99c7b2f2c2ad44"
}
}
},
"amount_details": {
"amount": 10000,
"currency": "rub"
},
"metadata": "good"
}]
}
}

Step 4. Wait for a notification that Pike is ready to perform the payout

Pike will send you a ready_to_confirm webhook (using the webhook address you provided to your Pike manager previously). This means that the payout can be performed and Pike is waiting for you to confirm (or cancel) the operation. 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@test.ru"
}]
},
"payment_method": {
"type": "card",
"card": {
"type": "tokenized_card",
"tokenized_card": {
"token": "759c9852dde2211d7531b3d905c1d513fbfb914bee87fb567d99c7b2f2c2ad44"
}
}
},
"amount_details": {
"amount": 10000,
"currency": "rub"
},
"metadata": "good"
}]
}
}'

Step 5. Confirm or cancel the payout

Check the payout details and either confirm it (using session/confirm), or cancel it (using session/cancel).

Example
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"
}'

Step 6. Wait for the results

Pike will send you a payment_finished webhook. The webhook body will contain all the payout details. The payout result is in the status field of the payments/payout_list array.

Learn more about the payout statuses