Our Android Drop-in renders Google Pay™ in your
payment form. When shoppers select Google Pay, Drop-in presents the Google Pay
payment sheet where shoppers choose a card they want to use. If shoppers select
a card that requires 3D Secure authentication, Drop-in also handles redirecting
shoppers to another website to complete the verification.
Show Google Pay™ in your payment form
Drop-in uses the countryCode and the amount.currency
from your
/paymentMethods request to
show the available payment methods to your shopper. From your server, make a
/paymentMethods request
specifying:
Optional configuration
When creating an instance of Drop-in, you
can optionally include a GooglePayConfiguration object to add custom configuration for Google
Pay in your payment form.
-
val
googlePayConfig =
GooglePayConfiguration.Builder(YourContext,
"YOUR_CLIENT_KEY")
-
.setAmount(amount)
-
// When you're ready to accept
live payments, change the value to one of our live
environments (for example, Environment.LIVE).
- .setEnvironment(Environment.TEST)
- .build()
-
val
dropInConfiguration =
-
DropInConfiguration.Builder(YourContext,
YourDropInService::class..java,
class="text-warning">"YOUR_CLIENT_KEY")
-
// When you're ready to accept
live payments, change the value to one of our live
environments (for example, Environment.LIVE).
- .setEnvironment(Environment.TEST)
-
// Required for versions
earlier than v4.5.0. When you're ready to accept live
payments, change the value to ENVIRONMENT_PRODUCTION.
- .setGooglePayEnvironment(WalletConstants.ENVIRONMENT_TEST)
- .addGooglePayConfiguration(googlePayConfig)
- .build()
Make a payment
When the shopper proceeds to pay, Drop-in returns the
paymentComponentData.paymentMethod
-
Pass the
paymentComponentData.paymentMethod
to your server.
-
From your server, make a /payments request,
specifying:
-
paymentMethod
: The
paymentComponentData.paymentMethod from your client app.
-
browserInfo
: Required if you want to trigger 3D Secure authentication .
-
returnURL
URL where the shopper will be redirected
back to after completing a 3D Secure authentication. The
returnUrl can have a maximum of 1024 characters. Get this URL
from the Component in the
RedirectComponent.getReturnUrl(context).
-
curl
https://checkout-test.Noqoody.com/v68/payments
\
-
-H "x-API-key: YOUR_X-API-KEY" \
-
-H "content-type: application/json" \
-
-d '{
-
"merchantAccount":"YOUR_MERCHANT_ACCOUNT",
-
"reference":"YOUR_ORDER_NUMBER",
-
"amount":{
-
"currency":"EUR",
-
"value":1000
-
},
-
"paymentMethod":{
-
"type":"googlepay",
-
"googlePayToken":
"{\"signature\":\"MEUCIFNbi10fa\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"u4YsMQ4i56lTS..D+2m9vYwY\\\",\\\"ephemeralPublicKey\\\":\\\"BIwdzX4a+rC1DiKY6/8Y\\\\u003d\\\",\\\"tag\\\":\\\"pe0MF+z7\\\\u003d\\\"}\"}"
-
},
-
"browserInfo: {
-
"userAgent":"Mozilla/5.0 (Linux;
Android 6.0.1; Nexus 6P Build/MMB29P)
AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/47.0.2526.83 Mobile
Safari/537.36",
-
"acceptHeader":"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8"
- },
-
"returnUrl":"Noqoodycheckout://your.package.name"
- }'
-
# Set your X-API-KEY with
the API key from the Customer Area.
-
Noqoody = Noqoody::Client.new
-
Noqoody.api_key = "YOUR_X-API-KEY"
-
-
response = Noqoody.checkout.payments({
-
:amount
=> {
-
:currency
=>
"EUR"
,
-
:value
=>
1000
-
}
-
:reference
=>
"YOUR_ORDER_NUMBER"
,
-
:paymentMethod
=> {
-
:type
=>
"googlepay"
,
-
:googlePayToken
=>
"{\"signature\":\"MEUCIFNbi10fa\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"u4YsMQ4i56lTS..D+2m9vYwY\\\",\\\"ephemeralPublicKey\\\":\\\"BIwdzX4a+rC1DiKY6/8Y\\\\u003d\\\",\\\"tag\\\":\\\"pe0MF+z7\\\\u003d\\\"}\"}"
,
-
}
-
:browserInfo
=> {
-
:userAgent
=>
"Mozilla/5.0 (Linux;
Android 6.0.1; Nexus 6P Build/MMB29P)
AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/47.0.2526.83 Mobile
Safari/537.36",
-
:acceptHeader
=>
"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8"
-
};
-
:returnUrl
=>
"Noqoodycheckout://your.package.name"
,
-
:merchantAccount
=>
"YOUR_MERCHANT_ACCOUNT"
-
})
-
// Set YOUR_X-API-KEY with
the API key from the Customer Area.
-
// Change to
Environment.LIVE and add the Live URL prefix
when you're ready to accept live
payments.
-
Client client =
new
Client(
"YOUR_X-API-KEY"
, Environment.TEST);
-
Checkout checkout =
new
Checkout(client);
-
-
PaymentsRequest paymentsRequest
=
new
PaymentsRequest();
-
-
String merchantAccount =
"YOUR_MERCHANT_ACCOUNT"
-
paymentsRequest.setMerchantAccount(merchantAccount);
-
-
GooglePayDetails
googlePayDetails =
new
GooglePayDetails();
-
-
googlePayDetails.setGooglePayToken(state.data.paymentMethod.googlePayToken);
-
paymentsRequest.setPaymentMethod(googlePayDetails);
-
-
BrowserInfo browserInfo =
new
BrowserInfo();
-
browserInfo.setUserAgent(
"Mozilla/5.0 (Linux;
Android 6.0.1; Nexus 6P Build/MMB29P)
AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/47.0.2526.83 Mobile Safari/537.36"
);
-
browserInfo.setAcceptHeader(
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
);
-
-
paymentsRequest.setBrowserInfo(browserInfo);
-
-
paymentsRequest.setReference(
"YOUR_ORDER_NUMBER"
);
-
paymentsRequest.setReturnUrl(
"Noqoodycheckout://your.package.name"
);
-
-
PaymentsResponse paymentsResponse
= checkout.payments(paymentsRequest);
-
// Set your X-API-KEY with
the API key from the Customer Area.
-
$client =
new
\Noqoody\Client();
-
$client->setXApiKey(
"YOUR_X-API-KEY"
);
-
$service =
new
\Noqoody\Service\Checkout($client);
-
-
$params =
array
(
-
"amount"
=>
array
(
-
"amount"
=>
array
(
-
"currency"
=>
"EUR"
,
-
"value"
=>
1000
-
)
-
"reference"
=>
"YOUR_ORDER_NUMBER"
,
-
:paymentMethod
=> {
-
:type
=>
"googlepay"
,
-
:googlePayToken
=>
"{\"signature\":\"MEUCIFNbi10fa\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"u4YsMQ4i56lTS..D+2m9vYwY\\\",\\\"ephemeralPublicKey\\\":\\\"BIwdzX4a+rC1DiKY6/8Y\\\\u003d\\\",\\\"tag\\\":\\\"pe0MF+z7\\\\u003d\\\"}\"}"
,
-
}
-
:browserInfo
=> {
-
:userAgent
=>
"Mozilla/5.0 (Linux;
Android 6.0.1; Nexus 6P Build/MMB29P)
AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/47.0.2526.83 Mobile
Safari/537.36",
-
:acceptHeader
=>
"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8"
-
};
-
:returnUrl
=>
"Noqoodycheckout://your.package.name"
,
-
:merchantAccount
=>
"YOUR_MERCHANT_ACCOUNT"
-
)
-
$result = $service->payments($params);
-
# Set your X-API-KEY with
the API key from the Customer Area.
-
Noqoody = Noqoody.Noqoody()
-
Noqoody.client.xapikey =
'YOUR_X-API-KEY'
-
-
response = Noqoody.checkout.payments({
-
:amount
=> {
-
:value
=>
1000
-
:currency
=>
"EUR"
,
-
}
-
:reference
=>
"YOUR_ORDER_NUMBER"
,
-
:paymentMethod
=> {
-
:type
=>
"googlepay"
,
-
:googlePayToken
=>
"{\"signature\":\"MEUCIFNbi10fa\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"u4YsMQ4i56lTS..D+2m9vYwY\\\",\\\"ephemeralPublicKey\\\":\\\"BIwdzX4a+rC1DiKY6/8Y\\\\u003d\\\",\\\"tag\\\":\\\"pe0MF+z7\\\\u003d\\\"}\"}"
,
-
}
-
:browserInfo
=> {
-
:userAgent
=>
"Mozilla/5.0 (Linux;
Android 6.0.1; Nexus 6P Build/MMB29P)
AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/47.0.2526.83 Mobile
Safari/537.36",
-
:acceptHeader
=>
"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8"
-
};
-
:returnUrl
=>
"Noqoodycheckout://your.package.name"
,
-
:merchantAccount
=>
"YOUR_MERCHANT_ACCOUNT"
-
})
-
// Set your X-API-KEY with
the API key from the Customer Area.
-
var
client =
new
Client (
"YOUR_X-API-KEY"
, Environment.Test);
-
-
var
amount =
new
Model.Checkout.Amount(
"EUR"
,
1000
);
-
var
details =
new
Model.Checkout.DefaultPaymentMethodDetails{
-
$service =
new
\Noqoody\Service\Checkout($client);
-
-
Type =
"googlepay"
,
-
GooglePayToken =
"{\"signature\":\"MEUCIFNbi10fa\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"u4YsMQ4i56lTS..D+2m9vYwY\\\",\\\"ephemeralPublicKey\\\":\\\"BIwdzX4a+rC1DiKY6/8Y\\\\u003d\\\",\\\"tag\\\":\\\"pe0MF+z7\\\\u003d\\\"}\"}"
- };
-
var
browserInfo =
new
Model.Checkout.BrowserInfo{
-
UserAgent =
@"Mozilla/5.0 (Linux;
Android 6.0.1; Nexus 6P Build/MMB29P)
AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/47.0.2526.83 Mobile Safari/537.36"
,
-
AcceptHeader =
@"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8"
,
- };
-
var
paymentRequest =
new
Noqoody.Model.Checkout.PaymentRequest
- {
-
Reference =
"YOUR_ORDER_NUMBER"
,
-
Amount = amount,
-
ReturnUrl =
@"Noqoodycheckout://your.package.name"
,
-
MerchantAccount =
"YOUR_MERCHANT_ACCOUNT"
,
-
PaymentMethod = details,
-
BrowserInfo = browserInfo
- };
-
-
var
paymentResponse =
checkout.Payments(paymentsRequest);
-
// Set your X-API-KEY with
the API key from the Customer Area.
-
const
{Client, Config, CheckoutAPI} =
require
(
'@Noqoody/api-library'
);
-
const
config =
new
Config();
- // Set your X-API-KEY with
the API key from the Customer Area.
-
config.apiKey =
'[API_KEY]'
;
-
config.merchantAccount =
'[YOUR_MERCHANT_ACCOUNT]'
;
-
const
client =
new
Client({ config });
-
client.setEnvironment(
"TEST"
);
-
const
checkout =
new
CheckoutAPI(client);
-
checkout.payments({
-
amount: { currency:
"EUR"
, value:
1000
}
-
paymentMethod: {
-
type:
'googlepay'
,
-
googlePayToken:
'{\"signature\":\"MEUCIFNbi10fa\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"u4YsMQ4i56lTS..D+2m9vYwY\\\",\\\"ephemeralPublicKey\\\":\\\"BIwdzX4a+rC1DiKY6/8Y\\\\u003d\\\",\\\"tag\\\":\\\"pe0MF+z7\\\\u003d\\\"}\"}'
-
},
-
browserInfo: {
-
userAgent:
'Mozilla/5.0 (Linux;
Android 6.0.1; Nexus 6P Build/MMB29P)
AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/47.0.2526.83 Mobile
Safari/537.36',
,
-
acceptHeader:
'text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,image\/apng,*\/*;q=0.8'
}
-
},
-
reference:
"YOUR_ORDER_NUMBER"
,
- merchantAccount:
config.merchantAccount,
-
returnUrl:
"Noqoodycheckout://your.package.name"
- }).then(res => res);
The response contains the result of the payment.
-
{
-
"pspReference":
"JDD6LKT8MBLZNN84"
,
-
"resultCode":
"Authorised"
-
}
If the shopper used a card that requires 3D Secure authentication before the
payment can be completed, you receive an action.type
redirect in the response.
/payments response for a card that requires 3D Secure
authentication
-
{
-
"resultCode":
"RedirectShopper"
,
-
"action": {
-
"url":
"https://test.Noqoody.com/hpp/3d/validate.shtml"
,
-
"paymentMethodType":
"scheme"
,
-
"data": {
-
"MD":
"OEVudmZVMUlkWjd0MDNwUWs2bmhSdz09..."
,
-
"PaReq":
"eNpVUttygjAQ/RXbDyAXBYRZ00HpTH3wUosPfe..."
,
-
"TermUrl":
"https://example.com/checkout?shopperOrder=12xy..."
,
-
},
-
"method":
"POST"
,
-
"type":
"redirect"
,
-
}
-
}
3. If you received an action object, pass the action object
to your client app and return it inside a DropInServiceResult.Action.
If you did not receive an action object, proceed to present the payment
result to your shopper.
Cards with 3D Secure: Check the payment result
Drop-in redirects the shopper to complete the payment. When the shopper
returns back to your app, Drop-in provides the
actionComponentData
object.
From your server, make a POST /payments/details
request providing:
details:
The actionComponentData.details
object from Drop-in.
/payments/details request
-
curl https://checkout-test.Noqoody.com/v68/payments
\
-
-H
"x-API-key:
YOUR_X-API-KEY"
\
-
-H
"content-type:
application/json"
\
-
-
-d '
{
-
"details":{
-
"redirectResult":
"eyJ0cmFuc1N0YXR1cyI6IlkifQ=="
-
},
- }'
You receive a response containing:
resultCode
: Use this to present the payment result to your
shopper.
pspReference
: Our unique identifier for the transaction.
/payments/details response
-
{
-
"resultCode":
"Authorised"
-
"pspReference":
"JDD6LKT8MBLZNN84"
,
-
}
-
Present the payment result
Use the resultCode that you received in the /payments
or //payments/details
response to present the payment result to your shopper.
The resultCode
values you can receive for Google Pay™ are:
resultCode |
Description |
Action to take |
Authorised |
The payment was successful. |
Inform the shopper that the payment has been successful. |
Error |
There was an error when the payment was being processed. |
Inform the shopper that there was an error processing their
payment. The response contains a refusalReason ,
indicating the cause of the error. |
Refused |
The payment was refused by the shopper's bank. |
Ask the shopper to try the payment again using a different
payment method. |
Test and go live
To test Google Pay, log in to a Google account and create a Google
Pay wallet with the details of a real card, not a test card. When
you make a test payment, the card number is automatically mapped to
our test card number starting with 4111, so the real card is not
charged.
Before you go live
- Make sure your API credential has the API Clientside
Encryption Payments role. Check this in your live Customer Area or ask your
Admin user to verify.
- Contact our Support
Team
and submit a request to configure your Google Pay™
merchantID
.
- Complete all of the steps in the Google Pay™ API deploy to production documentation
for
Web .
In the live environment, note that Google Pay™ will only be available
if: