Skip to main content

Payments using the payment form

This scenario describes how to perform a payment to a bank card through the payment form. You should consider this option if you decided not to collect bank card details and not to store them on your side.

You can obtain tokenized card details using the payment form widget and then perform the payment securely.

This scenario does not include the payment capture step. How to make a delayed capture payment.

  1. Create a session using the session/create request.

    Pass your project identifier and signature in the request headers.

    More about the request format

    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 '{
    "customer": {
    "reference": "user123",
    "contacts": [{
    "email": "user@gmail.com"
    }]
    },
    "amount_details": {
    "amount": 10000,
    "currency": "rub"
    },
    "metadata": "order123"
    }'
  2. Send a token request specifying the session identifier and the type of the widget you are going to call. You will receive a token in response.

    If you want to add the I agree to recurring payments checkbox to the payment form, specify true in the show_recurrent_checkbox field. It is required if you want to perform recurring debiting.
    Note that initially this checkbox can be either empty (by default) or preselected. If you prefer it to be preselected, please contact your Account Manager.

    Example
    curl -X POST \
    https://proxy-demo.pikepayments.com/api/v1/token \
    -H 'Content-Type: application/json' \
    -H 'X-PARTNER-PROJECT: your_project_name' \
    -H 'X-PARTNER-SIGN: signature' \
    -d '{
    "acquiring_widget": {
    "session_id": "ps_123456"
    }
    }'
  3. Show the payment form to the recipient. To do this, you need to access our JavaScript library and add the payment form widget.

    How to add the payment form

  4. Pike will send you a ready_to_confirm webhook. This means that the payment can be performed and Pike is waiting for you to confirm (or cancel) it.

    The webhook body will contain all the data needed for the payment.

    Reply with the 200 HTTP code.

    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",
    "acquiring_payments": [{
    "id": "pm_2705",
    "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": "rub"
    },
    "metadata": "good"
    }]
    }
    }'
  5. Check the payment details and confirm that you are ready to perform the payment (using the session/confirm request) or cancel it (using the session/cancel request).

    If you receive an action_required webhook, send the HTTP 200 OK in response—the user will be redirected for 3D Secure within the widget.

Examples
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"
}'
  1. Wait for a payment_finished webhook. The webhook body will contain all the details of the payment. The result of the payment can be found in the status field of the acquiring_payments/payment_list array.

    If the status is succeeded, then the payment was successful.

    More about the payment statuses

Diagram for payment via payment form

Diagram for payment via payment form