diff --git a/README.md b/README.md index aca2f7c..0c2222a 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,9 @@ const { shippingAddressRequired: false, userAction: 'commit', // display 'Pay Now' on the PayPal review page // one of 'authorize', 'sale', 'order'. defaults to 'authorize'. see details here: https://developer.paypal.com/docs/api/payments/v1/#payment-create-request-body - intent: 'authorize', + intent: 'authorize', + // support pay later offers. see details here: https://developer.paypal.com/braintree/docs/guides/paypal/pay-later-offers/android/v3 + offerPayLater: false, } ); diff --git a/android/src/main/java/com/smarkets/paypal/RNPaypalModule.java b/android/src/main/java/com/smarkets/paypal/RNPaypalModule.java index b697b42..1b89750 100644 --- a/android/src/main/java/com/smarkets/paypal/RNPaypalModule.java +++ b/android/src/main/java/com/smarkets/paypal/RNPaypalModule.java @@ -58,6 +58,8 @@ public void requestOneTimePayment( PayPalRequest request = new PayPalRequest(options.getString("amount")) .intent(PayPalRequest.INTENT_AUTHORIZE); + if (options.hasKey("offerPayLater")) + request.offerPayLater(options.getBoolean("offerPayLater")); if (options.hasKey("currency")) request.currencyCode(options.getString("currency")); if (options.hasKey("displayName")) diff --git a/index.d.ts b/index.d.ts index 0634afb..bdd655b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -92,6 +92,7 @@ declare function requestOneTimePayment(token: string, { shippingAddressRequired, userAction, intent, + offerPayLater, }: { amount: string, currency ? : paypalSupportedCurrencies, @@ -99,6 +100,7 @@ declare function requestOneTimePayment(token: string, { shippingAddressRequired ? : boolean, userAction ? : 'commit' | 'continue', intent ? : 'sale' | 'authorize' | 'order', + offerPayLater ? : boolean, }): Promise ; declare function requestBillingAgreement(token: string, { diff --git a/ios/RNPaypal.m b/ios/RNPaypal.m index 7dc8dad..98433a3 100644 --- a/ios/RNPaypal.m +++ b/ios/RNPaypal.m @@ -42,6 +42,8 @@ + (BOOL)requiresMainQueueSetup payPalDriver.appSwitchDelegate = self; BTPayPalRequest *request= [[BTPayPalRequest alloc] initWithAmount:options[@"amount"]]; + BOOL offerPayLater = [options[@"offerPayLater"] boolValue]; + if (offerPayLater) request.offerPayLater = offerPayLater; NSString* currency = options[@"currency"]; if (currency) request.currencyCode = currency; NSString* displayName = options[@"displayName"];