Sent by the server to your API when a user pays in an app whose Google Pay or Apple Pay gateway is set to External Provider. It carries the tokenized card data for you to charge.
You do not request this message β it arrives on your WebSocket session whenever a payment needs authorizing.
Field | Type | Returned | Description |
method | String | Yes | "paymentAuthorizationRequest" |
order_id | String | Yes | Identifier of the order being paid. Echo it back in submitPaymentResult. |
account_id | Number | Yes | Account id of the paying user. |
amount | Number | Yes | Order amount. |
currency | String | Yes | Currency of the order. |
merchant_name | String | Yes | Merchant name configured for the app. |
secret | String | Yes | A short random value generated for this request only. Echo it back in submitPaymentResult. |
payload | Object | Yes | Wrapper holding the payment token β { "token": "<provider token>" }. |
provider_id | String | Yes | Which wallet produced the token: GOOGLEPAY or APPLEPAY. |
config | Object | Yes | The payment provider configuration for the app. |
debit_amount_cents | Number | Conditional | Amount in minor units. Sent for Google Pay only β it is not included in Apple Pay requests. |
β οΈ
payload and secret are sensitive. Do not log them.SDK Mapping β paymentAuthorizationRequest
SDK | Response Callback | Accessors |
Java | onPaymentAuthorizationRequest(PaymentRequest paymentRequest) | getOrderId(), getAccountId(), getAmount(), getCurrency(), getMerchantName(), getSecret(), getPaymentMethod(), getConfig() |
JavaScript | onPaymentAuthorizationRequest(paymentRequest) | .order_id, .account_id, .amount, .currency, .merchant_name, .secret, .payload, .provider_id, .config |
Python | on_payment_authorization_request(self, payment_request) | .order_id, .account_id, .amount, .currency, .merchant_name, .secret, .payload, .provider_id, .config |
Example
Event delivered to the API
json{ "method": "paymentAuthorizationRequest", "order_id": "5121960361126208", "account_id": 90090684293000559, "amount": 25.5, "currency": "USD", "merchant_name": "My Store", "secret": "a7Kd2P", "payload": { "token": "<provider payment token>" }, "provider_id": "GOOGLEPAY", "config": {}, "debit_amount_cents": 2550 }
Handling the request
java@Override public void onPaymentAuthorizationRequest(PaymentRequest paymentRequest) { JSONObject payload = paymentRequest.getPaymentMethod(); String token = (String) payload.get("token"); // charge `token` with your own payment service provider, then report back }
javascriptnCallBack.onPaymentAuthorizationRequest = (paymentRequest) => { const token = paymentRequest.payload.token; // charge `token` with your own payment service provider, then report back }
pythonclass nCallBack(nandbox.Callback): def on_payment_authorization_request(self, payment_request): token = payment_request.payload.get("token") # charge `token` with your own payment service provider, then report back