diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4199684611..80fb17239f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Braintree Android SDK Release Notes
+## unreleased
+* PayPal
+ * Add `PayPalContactInformation` request object
+ * Add `PayPalCheckoutRequest.contactInformation` optional property
+
## 5.3.0 (2024-12-11)
* PayPal
diff --git a/Demo/src/main/java/com/braintreepayments/demo/PayPalFragment.java b/Demo/src/main/java/com/braintreepayments/demo/PayPalFragment.java
index 86c067e408..f8b97304d4 100644
--- a/Demo/src/main/java/com/braintreepayments/demo/PayPalFragment.java
+++ b/Demo/src/main/java/com/braintreepayments/demo/PayPalFragment.java
@@ -9,6 +9,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
+import android.widget.Switch;
import android.widget.Toast;
import androidx.annotation.NonNull;
@@ -49,13 +50,15 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
TextInputEditText buyerPhoneNationalNumberEditText = view.findViewById(R.id.buyer_phone_national_number_edit_text);
Button billingAgreementButton = view.findViewById(R.id.paypal_billing_agreement_button);
Button singlePaymentButton = view.findViewById(R.id.paypal_single_payment_button);
+ Switch contactInformationSwitch = view.findViewById(R.id.contact_info_switch);
singlePaymentButton.setOnClickListener(v -> {
launchPayPal(
false,
buyerEmailEditText.getText().toString(),
buyerPhoneCountryCodeEditText.getText().toString(),
- buyerPhoneNationalNumberEditText.getText().toString()
+ buyerPhoneNationalNumberEditText.getText().toString(),
+ contactInformationSwitch.isChecked()
);
});
billingAgreementButton.setOnClickListener(v -> {
@@ -70,7 +73,8 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
true,
buyerEmailEditText.getText().toString(),
buyerPhoneCountryCodeEditText.getText().toString(),
- buyerPhoneNationalNumberEditText.getText().toString()
+ buyerPhoneNationalNumberEditText.getText().toString(),
+ false
);
});
@@ -116,7 +120,8 @@ private void launchPayPal(
boolean isBillingAgreement,
String buyerEmailAddress,
String buyerPhoneCountryCode,
- String buyerPhoneNationalNumber
+ String buyerPhoneNationalNumber,
+ Boolean isContactInformationEnabled
) {
FragmentActivity activity = getActivity();
activity.setProgressBarIndeterminateVisibility(true);
@@ -128,10 +133,10 @@ private void launchPayPal(
if (dataCollectorResult instanceof DataCollectorResult.Success) {
deviceData = ((DataCollectorResult.Success) dataCollectorResult).getDeviceData();
}
- launchPayPal(activity, isBillingAgreement, amount, buyerEmailAddress, buyerPhoneCountryCode, buyerPhoneNationalNumber);
+ launchPayPal(activity, isBillingAgreement, amount, buyerEmailAddress, buyerPhoneCountryCode, buyerPhoneNationalNumber, isContactInformationEnabled);
});
} else {
- launchPayPal(activity, isBillingAgreement, amount, buyerEmailAddress, buyerPhoneCountryCode, buyerPhoneNationalNumber);
+ launchPayPal(activity, isBillingAgreement, amount, buyerEmailAddress, buyerPhoneCountryCode, buyerPhoneNationalNumber, isContactInformationEnabled);
}
}
@@ -141,7 +146,8 @@ private void launchPayPal(
String amount,
String buyerEmailAddress,
String buyerPhoneCountryCode,
- String buyerPhoneNationalNumber
+ String buyerPhoneNationalNumber,
+ Boolean isContactInformationEnabled
) {
PayPalRequest payPalRequest;
if (isBillingAgreement) {
@@ -157,7 +163,8 @@ private void launchPayPal(
amount,
buyerEmailAddress,
buyerPhoneCountryCode,
- buyerPhoneNationalNumber
+ buyerPhoneNationalNumber,
+ isContactInformationEnabled
);
}
payPalClient.createPaymentAuthRequest(requireContext(), payPalRequest,
diff --git a/Demo/src/main/java/com/braintreepayments/demo/PayPalRequestFactory.java b/Demo/src/main/java/com/braintreepayments/demo/PayPalRequestFactory.java
index 3a5902b708..19ac8afc3e 100644
--- a/Demo/src/main/java/com/braintreepayments/demo/PayPalRequestFactory.java
+++ b/Demo/src/main/java/com/braintreepayments/demo/PayPalRequestFactory.java
@@ -7,6 +7,7 @@
import com.braintreepayments.api.paypal.PayPalBillingInterval;
import com.braintreepayments.api.paypal.PayPalBillingPricing;
import com.braintreepayments.api.paypal.PayPalCheckoutRequest;
+import com.braintreepayments.api.paypal.PayPalContactInformation;
import com.braintreepayments.api.paypal.PayPalLandingPageType;
import com.braintreepayments.api.paypal.PayPalPaymentIntent;
import com.braintreepayments.api.paypal.PayPalPaymentUserAction;
@@ -112,7 +113,8 @@ public static PayPalCheckoutRequest createPayPalCheckoutRequest(
String amount,
String buyerEmailAddress,
String buyerPhoneCountryCode,
- String buyerPhoneNationalNumber
+ String buyerPhoneNationalNumber,
+ Boolean isContactInformationEnabled
) {
PayPalCheckoutRequest request = new PayPalCheckoutRequest(amount, true);
@@ -159,6 +161,10 @@ public static PayPalCheckoutRequest createPayPalCheckoutRequest(
request.setShippingAddressOverride(shippingAddress);
}
+ if (isContactInformationEnabled) {
+ request.setContactInformation(new PayPalContactInformation("some@email.com", new PayPalPhoneNumber("1", "1234567890")));
+ }
+
return request;
}
}
diff --git a/Demo/src/main/res/layout/fragment_paypal.xml b/Demo/src/main/res/layout/fragment_paypal.xml
index 7f6dd173e3..8ef1c17075 100644
--- a/Demo/src/main/res/layout/fragment_paypal.xml
+++ b/Demo/src/main/res/layout/fragment_paypal.xml
@@ -49,6 +49,12 @@
+
+