Reputation: 1361
I integrated pay pal
payment gateway using sandbox. Everything working fine but in USD $ currency code AED currency not working please help if anyone has an idea, I just want AED currency for pay pal payment Checkout.
i am using this Android sdk-- implementation 'com.paypal.sdk:paypal-android-sdk:2.16.0'
Upvotes: 2
Views: 1211
Reputation: 329
You can try integrating Braintree for using Paypal. Braintree offer option for accepting PayPal Payment. But I'm not sure that will accept payment in aed or not. But hope it will provide some easy way to handle this. Initialize BraintreeFragment with your client token to make the request.
paypalPayment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
PayPal.authorizeAccount(braintreeFragment);
}});
If you want to collect billing addresses then add this piece of code PayPal.requestBillingAgreement(mBraintreeFragment, paypalRequest);
Make sure you implemented the PaymentMethodNonceCreatedListener to capture the PayPalAccountNonce.
@Override
public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
PayPalAccountNonce paypalAccountNonce = (PayPalAccountNonce) paymentMethodNonce;
PostalAddress billingAddress = paypalAccountNonce.getBillingAddress();
String streetAddress = billingAddress.getStreetAddress();
String extendedAddress = billingAddress.getExtendedAddress();
String locality = billingAddress.getLocality();
String countryCodeAlpha2 = billingAddress.getCountryCodeAlpha2();
String postalCode = billingAddress.getPostalCode();
String region = billingAddress.getRegion();}
Now invoking the checkout with Paypal -
public void setupBraintreeAndStartExpressCheckout() {
PayPalRequest request = new PayPalRequest("1")
.currencyCode("Currency Code")
.intent(PayPalRequest.INTENT_AUTHORIZE);
PayPal.requestOneTimePayment(mBraintreeFragment, request);
}
When you receive a callback in onPaymentMethodNonceCreated, you can query the PayPalAccountNonce object you get back for specific customer information
@Override
public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
// Send nonce to server
String nonce = paymentMethodNonce.getNonce();
if (paymentMethodNonce instanceof PayPalAccountNonce) {
PayPalAccountNonce payPalAccountNonce = (PayPalAccountNonce)paymentMethodNonce;
// Access additional information
String email = payPalAccountNonce.getEmail();
String firstName = payPalAccountNonce.getFirstName();
String lastName = payPalAccountNonce.getLastName();
String phone = payPalAccountNonce.getPhone();
// See PostalAddress.java for details
PostalAddress billingAddress = payPalAccountNonce.getBillingAddress();
PostalAddress shippingAddress = payPalAccountNonce.getShippingAddress();}}
You check this helpful link of Braintree here
Happy Coding..
Upvotes: 1
Reputation: 791
According to their documentation doc you can set different currency here:
public void setupBraintreeAndStartExpressCheckout() {
PayPalRequest request = new PayPalRequest("1")
.currencyCode("USD")
.intent(PayPalRequest.INTENT_AUTHORIZE);
PayPal.requestOneTimePayment(mBraintreeFragment, request);
}
and to find more about available currencies here
if you cant find the currency you are looking for than i would recommend doing the currency calculation yourself and send the final value to paypal
Upvotes: 0