Google Pay
Google Pay⢠allows customers to pay using their credit and debit cards stored inside their Google Account. This article describes how you can accept Google Pay payments using Paymentwall. Paymentwall supports payments with Google Pay without any additional integration effort. You can use Google Pay as an option within your credit card form powered by Paymentwall. To start using Google Pay, simply activate it following the steps below.
Activate Google Pay from the Merchant Area
- Log into your Paymentwall account and go to âPayment systemsâ section in âMy Projectsâ.
- Select âAdditional Payment Methodsâ under âCredit Cardsâ section.
- Turn on Google Pay and choose âACTIVATEâ.
Create Form
Option 1: Widget
No further actions required.
Option 2: Merchant hosts Brick.js and uses default Brick form
Option 2.1: Using Paymentwallâs Google merchant ID
No further actions required.
Option 2.2: Using merchantâs Google merchant ID
-
Refer to Googleâs documentation page for instructions on how to get your Google merchant ID
-
Add following param to Brick.js init options
google_pay: {
iframe: false,
merchant_id: '<merchantâs Google merchant ID>'
}
Example:
var brick = new Brick({
public_key: '<merchantâs Brick public key>',
amount: 9.99,
currency: 'USD',
container: 'payment-form-container',
action: '<merchantâs charge action>',
form: {
merchant: 'Paymentwall',
product: 'Gold Membership',
pay_button: 'Pay',
show_zip: true, // show zip code
show_cardholder: true // show card holder name
},
google_pay: {
iframe: false,
merchant_id: '<merchantâs Google merchant ID>'
}
});
Option 3: Merchant hosts Brick.js and uses custom form
- Add a <div> element where Google Pay button will be placed. This element must have an âidâ attribute
Option 3.1: Using Paymentwallâs Google merchant ID
- Add following param to Brick.js init options
google_pay: {
amount: 9.99,
currency: 'USD',
container_id: '<id of the element where Google Pay button will be placed>', // required only if id value is not "google-pay-container"
onTokenized: function (response, paymentData) {
$form.append($('input type="hidden" name="brick_token"/>').val(response.token));
$form.append($('input type="hidden" name="brick_fingerprint"/>').val(Brick.getFingerprint()));
$('#email').val(paymentData.email);
$form.get(0).submit();
}
}
Example:
var brick = new Brick({
public_key: '<merchantâs Brick public key>',
form: {
formatter: true
},
google_pay: {
amount: 9.99,
currency: 'USD',
container_id: '<id of the element where Google Pay button will be placed>', // required only if id value is not "google-pay-container"
onTokenized: function (response, paymentData) {
$form.append($('input type="hidden" name="brick_token"/>').val(response.token));
$form.append($('input type="hidden" name="brick_fingerprint"/>').val(Brick.getFingerprint()));
$('#email').val(paymentData.email);
$form.get(0).submit();
}
}
});
Option 3.2: Using merchantâs Google merchant ID
- Add following param to Brick.js init options
google_pay: {
iframe: false,
merchant_id: '<merchantâs Google merchant ID>',
amount: 9.99,
currency: 'USD',
container_id: '<id of the element where Google Pay button will be placed>', // required only if id value is not "google-pay-container"
onTokenized: function (response, paymentData) {
$form.append($('input type="hidden" name="brick_token"/>').val(response.token));
$form.append($('input type="hidden" name="brick_fingerprint"/>').val(Brick.getFingerprint()));
$('#email').val(paymentData.email);
$form.get(0).submit();
}
}
Example:
var brick = new Brick({
public_key: '<merchantâs Brick public key>',
form: {
formatter: true
},
google_pay: {
iframe: false,
merchant_id: '<merchantâs Google merchant ID>',
amount: 9.99,
currency: 'USD',
container_id: '<id of the element where Google Pay button will be placed>', // required only if id value is not "google-pay-container"
onTokenized: function (response, paymentData) {
$form.append($('input type="hidden" name="brick_token"/>').val(response.token));
$form.append($('input type="hidden" name="brick_fingerprint"/>').val(Brick.getFingerprint()));
$('#email').val(paymentData.email);
$form.get(0).submit();
}
}
});
Option 4: Merchant implements own logic to get Google Pay token and sends it to Brick API to create charge
Refer to Googleâs documentation for instructions to get Google Pay token
Charge
Option 1: Widget
No further actions required
Option 2 and 3: Merchant hosts Brick.js
Similar to regular Brick integration, except:
- Unlike regular credit cards payment flow, merchantâs server script must not require customer[first_name] or customer[last_name]
- If merchant uses default Brick form, there will be a parameter âbrick_tokenization_methodâ whose value is âgooglepayâ sent to merchantâs charge endpoint
Option 4: Merchant implements own logic to get Google Pay token and sends it to Brick API to create charge
Similar to Brick.js integration, except:
- Instead of sending brick token, merchantâs script must send Google Pay token to Brick charge endpoint Example charge params:
<?php
$chargeInfo = array(
'email' => $parameters['email'],
'history[registration_date]' => '1489655092',
'amount' => 9.99,
'currency' => 'USD',
'google_pay_token' => $parameters['google_pay_token'],
'description' => 'Order #123'
);
?>