Skip to main content

Documentation

Creating a Payment with Google Pay™

You can create a payment with Google Pay™ in the sandbox environment.

Prerequisites:

  • Set an account with Google Pay sandbox for receiving a token for testing.

  • In the Client Portal, enable the Google Pay Wallet in Settings > Payment Methods > Google Pay

Create the payment as described in Create Payment.

  • Set payment_method.type to the relevant payment method type.

    • Set digital_wallet.type to google_pay.

Use the following guidelines for the digital_wallet.details object:

Parameter

Value

token.apiVersionMinor

0

token.apiVersion

2

tokenizationData.type

PAYMENT_GATEWAY

tokenizationData.description

Optional. Accepts any text.

tokenizationData.token

Set payment_method.digital_wallet.details.token to the entire token object that you got from Google Pay™, without any changes. The example here has truncated some of the long values for clarity.

type

CARD

info.cardNetwork

MASTERCARD, VISA

info.cardDetails

1111 (for Sandbox)

Sample Request

Request URL - post https://sandboxapi.rapyd.net/v1/payments/

{
    "amount": 10,
    "currency": "USD",
    "description": "Google Pay test payment",
    "payment_method": {
        "type": "us_debit_visa_card",
        "metadata": {},
        "digital_wallet": {
            "type": "google_pay",
            "details": {
                "token": {
                    "apiVersionMinor": 0,
                    "apiVersion": 2,
                    "paymentMethodData": {
                        "description": "VISA ••••1111",
                        "tokenizationData": {
                            "type": "PAYMENT_GATEWAY",
                            "token": "{\"signature\":\"MEUCIQn/q7\\"
                        }
                    }
                },
                "type": "CARD",
                "info": {
                    "cardNetwork": "VISA",
                    "cardDetails": "1111"
                }
            }
        }
    }
}

Sample Response

{
    "status": {
        "error_code": "",
        "status": "SUCCESS",
        "message": "",
        "response_code": "",
        "operation_id": "4b31045f-cf5f-4c23-8267-6db412f507bf"
    },
    "data": {
        "id": "payment_dbadbc4c8aae555bfdf5213f57653d1e",
        "amount": 10,
        "original_amount": 10,
        "is_partial": false,
        "currency_code": "USD",
        "country_code": "US",
        "status": "CLO",
        "description": "Google Pay test payment",
        "merchant_reference_id": "",
        "customer_token": "cus_8a9529afed6128dab4b468ebe4146d5f",
        "payment_method": "card_05e9f50472917dffd4cd8b675b749aa2",
        "payment_method_data": {
            "id": "card_05e9f50472917dffd4cd8b675b749aa2",
            "type": "us_debit_visa_card",
            "category": "card",
            "metadata": {},
            "image": "",
            "webhook_url": "",
            "supporting_documentation": "",
            "next_action": "not_applicable",
            "digital_wallet": {
                "type": "google_pay",
                "pan_type": "PAN_ONLY"
            }
        },
        "auth_code": null,
        "expiration": 1673793527,
        "captured": true,
        "refunded": false,
        "refunded_amount": 0,
        "receipt_email": "",
        "redirect_url": "",
        "complete_payment_url": "",
        "error_payment_url": "",
        "receipt_number": "",
        "flow_type": "",
        "address": null,
        "statement_descriptor": "Doc Team",
        "transaction_id": "",
        "created_at": 1673188727,
        "metadata": {},
        "failure_code": "",
        "failure_message": "",
        "paid": true,
        "paid_at": 1673188727,
        "dispute": null,
        "refunds": null,
        "order": null,
        "outcome": null,
        "visual_codes": {},
        "textual_codes": {},
        "instructions": [],
        "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861",
        "ewallets": [
            {
                "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861",
                "amount": 10,
                "percent": 100,
                "refunded_amount": 0
            }
        ],
        "payment_method_options": {},
        "payment_method_type": "us_debit_visa_card",
        "payment_method_type_category": "card",
        "fx_rate": 1,
        "merchant_requested_currency": null,
        "merchant_requested_amount": null,
        "fixed_side": "",
        "payment_fees": null,
        "invoice": "",
        "escrow": null,
        "group_payment": "",
        "cancel_reason": null,
        "initiation_type": "customer_present",
        "mid": "",
        "next_action": "not_applicable",
        "error_code": "",
        "remitter_information": {}
    }
}

Related Information