Reputation: 4269
I have implemented Braintree SDK which supports pay using Paypal, Credit or Debit Card and Google Pay.
All are working except Google Pay. I am getting following error while selecting payment method as GooglePay.
This merchant is not enabled for Google Pay Even I have enabled Google Pay option on Braintree console.
following is the code for implementation:
Code on Pay button click:
DropInRequest dropInRequest = new DropInRequest()
.amount(strAmount)
.googlePaymentRequest(getGooglePaymentRequest())
.tokenizationKey("production_key_xxxxxxxxx");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
startActivityForResult(dropInRequest.getIntent(getActivity()), 399);
}
private GooglePaymentRequest getGooglePaymentRequest() {
return new GooglePaymentRequest()
.transactionInfo(TransactionInfo.newBuilder()
.setTotalPrice(strAmount)
.setCurrencyCode("USD")
.setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
.build())
.emailRequired(true);
}
Help would be appreciated.
Upvotes: 0
Views: 3109
Reputation: 714
You also need to add googleMerchantId("YOUR-MERCHANT-ID")
The merchantId parameter inside PaymentDataRequest must be set to the value provided in your Google Pay Developer profile.
https://developers.google.com/pay/api/web/support/troubleshooting#merchantId
Upvotes: 0
Reputation: 5554
To use the Google Pay API in production, you need to have it enabled for your app on Google's side as well.
Their Integration checklist is a good place to start, specifically it has a section called Requesting production access
Upvotes: 0
Reputation: 701
Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.
It looks like you're trying to pass the incorrect Google Pay object for a standalone Google Pay integration through Braintree into your Drop-in UI.
If you haven't already, you need to include the Google Pay meta tag in your AndroidManifest.xml
:
<meta-data android:name="com.google.android.gms.wallet.api.enabled" android:value="true"/>
Then, construct a GooglePaymentRequest
object and pass it to your DropInRequest
object. The object may look something like:
private void enableGooglePay(DropInRequest dropInRequest) {
GooglePaymentRequest googlePaymentRequest = new GooglePaymentRequest()
.transactionInfo(TransactionInfo.newBuilder()
.setTotalPrice("1.00")
.setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
.setCurrencyCode("USD")
.build())
.billingAddressRequired(true); // We recommend collecting and passing billing address information with all Google Pay transactions as a best practice.
dropInRequest.googlePaymentRequest(googlePaymentRequest);
}
You can find more information about this in our developer docs.
Upvotes: 0