Google Pay™
This scenario describes how to perform a payment to a bank card via Google Pay. To use this scenario, integrate Google Pay into your website or application
Step 1. Get a payment token from Google Pay
- A user forms an order on your website or application.
- The user selects Google Pay as a payment method.
- The user selects one of his saved cards or enters details of a new one.
- The user clicks Pay.
- Google passes you a token.
Step 2. Start a payment session
Send a session/init/payment
request to start a payment session. In the payment_details.type
field, specify secured_card
. In the secured_card
object, pass the data needed to process the payment.
Request headers should be used to pass your project identifier and the request's signature.
Request example: session creation with simultaneous payment initiation
curl -X POST \
https://proxy-playground.bank131.ru/api/v1/session/init/payment' \
-H 'Content-Type: application/json' \
-H 'X-PARTNER-PROJECT: your_project_name' \
-H 'X-PARTNER-SIGN: signature' \
-d '{
"payment_details": {
"type": "secured_card",
"secured_card": {
"type": "google_pay",
"google_pay": {
"token": "{\"signature\":
\"MEgKey\":{\"signedKey\":\"{\\\"keyValue\\\":\\\"MFkwEwbcg\\\\u003d\\\\u003d\\\",\\\"keyExpiration\\\":\\\"118716\\\"}\",\"signatures\":[\"MEQCIw\\u003d\\u003d\"]},\"protocolVersion\":\"ECv2\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"wkJmz3OvO4\\\\u003d\\\"}\"}"
}
}
},
"amount_details": {
"amount": 100,
"currency": "rub"
},
"metadata": {
"key": "value"
},
"customer": {
"reference": "lucky"
}
}'
Step 3. 3D Secure
If the user's card requires 3D Secure, Bank 131 will send you the webhook action_required
with redirection details. Redirect the user to the address that will be specified in the customer_interaction.redirect.url
field.
Step 4. 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 status
field of the acquiring_payments/payment_list
object.
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.
More about the payment statuses
All done, the payment has been performed.