Loading...
These solutions are available in US and Canada only. For all other regions, please contact us for support.
To enable the Google Pay button, update your payment page with the following configuration.
const paymentRequestForm =
GlobalPayments.paymentRequest.setup("#paymentRequestPlainButton", {
total: {
label: 'Donation',
amount: {
currency: 'USD',
value: '1.00'
}
},
}, [applePayOptions, googlePayOptions]);
const googlePayOptions = {
supportedMethods: "https://google.com/pay",
data: {
environment: 'PRODUCTION',
apiVersion: 2,
apiVersionMinor: 0,
merchantInfo: {
// A merchant ID is available after approval by Google.
// https://developers.google.com/pay/api/web/guides/test-and-deploy/integration-checklist
merchantId: '12345678901234567890',
merchantName: 'Example Merchant'
},
allowedPaymentMethods: [{
type: 'CARD',
parameters: {
allowedAuthMethods: ["PAN_ONLY", "CRYPTOGRAM_3DS"],
allowedCardNetworks: ["AMEX", "DISCOVER", "INTERAC", "JCB", "MASTERCARD", "VISA"]
},
tokenizationSpecification: {
type: 'PAYMENT_GATEWAY',
parameters: {
'gateway': 'globalpaymentsinc', // Use this value
'gatewayMerchantId': '{merchant-key}' // Check your MSH/OEV account for this value
}
}
}]
}
}When the customer completes the Google Pay checkout process, the JavaScript Library sends a token-success callback with a temporary_token. This is the token that you must submit to the REST API in order to process the transaction.
paymentRequestForm.on("token-success", (resp) => {
// Payment data was successfully tokenized
// TODO: pass to the server-side for processing
});
paymentRequestForm.on("token-error", (resp) => {
// TODO: Handle error received during tokenization
});
paymentRequestForm.on("error", (resp) => {
// TODO: Handle Error received during the request process.
});
// Mark the payment as `success`, `fail`, or `unknown` based on the REST API response
GlobalPayments.paymentRequest.complete("success");Once you have the temporary_token, submit the Google Pay transaction to the REST API.
| Environment | HTTP method | URL |
|---|---|---|
| Sandbox | POST | https://api.pit.paygateway.com/transactions/creditsales |
| Production | POST | https://api.paygateway.com/transactions/creditsales |
{
"reference_id": "{{transaction_reference_d}}",
"card": {
"temporary_token": "{{temp_token}}"
},
"customer": {
"billing_address": {
"line1": "8200 Central Ave.",
"postal_code": "94560"
}
},
"payment": {
"amount": "0.00",
"currency_code": "840"
},
"transaction": {
"country_code": "840",
"processing_indicators": {
"create_token": true,
"address_verification_service": true,
"generate_receipt": true
}
}
}{
"sale_id": "000000003015",
"status": "Approved",
"approval_code": "005741",
"cardsecurity_response": "match",
"processor_response": "DEVELOPMENT APPROVAL",
"card": {
"masked_card_number": "545454XXXXXX5454",
"expiry_month": "12",
"expiry_year": "35",
"type": "MasterCard"
},
"payment": {
"amount": "33.00",
"currency_code": "840",
"reference_id": "PAYAPI-8f07eb9a-6e05-4a9f-b03d-7b05280a4ae6",
"type": "Credit"
},
"transaction": {
"batch_amount": "543.00",
"batch_number": "000253",
"entry_type": "Keyed",
"language": "en-US"
}
}For additional capabilities and shared details - like follow on transactions, supported codes, error references etc, see: