PayPal

PayPal Creditanchor

important

This guide has been deprecated. Please use the pay later offers guide instead.

PayPal Credit is an instant, reusable credit line your customers can use at checkout. It appears as an additional button in your checkout form and offers all available financing options to customers automatically through a PayPal UI – including Easy Payments in the US and Instalments in the UK, if those have been enabled for your PayPal account.

Before you get startedanchor

  1. See our PayPal Credit support article for full details on the availability and benefits of this feature
  2. Complete your PayPal client-side integration

Integrationanchor

Offering PayPal Credit is similar to offering regular PayPal payments.

  1. Add a PayPal Credit button
  1. XML
<ImageButton
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:src="@drawable/paypal_credit_button"
  android:background="@android:color/transparent" />
  1. Tokenize using PayPal Credit
    • On the PayPalRequest object, set the offerCredit option to true
  2. Submit the resulting payment method nonce to your server to create a transaction

Examplesanchor

PayPal and PayPal Credit with the Vault flowanchor

Here is an example of a Vault flow integration with both PayPal and PayPal Credit buttons:

  1. Java
//-- PayPal Button --
paypalButton.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View view) {
    PayPalRequest request = new PayPalRequest()
      .currencyCode("USD")
    PayPal.requestBillingAgreement(mBraintreeFragment, request);
  }
}

//-- PayPal Credit Button --
paypalCreditButton.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View view) {
    PayPalRequest request = new PayPalRequest()
      .currencyCode("USD")
      .offerCredit(true); // Offer PayPal Credit
    PayPal.requestBillingAgreement(mBraintreeFragment, request);
  }
}

When you receive a callback in onPaymentMethodNonceCreated, you can query the PayPalAccountNonce object you get back for specific customer information.

  1. Java
public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
  if (paymentMethodNonce instanceof PayPalAccountNonce) {
    PayPalAccountNonce paypalAccountNonce = (PayPalAccountNonce) paymentMethodNonce;

    PayPalCreditFinancing creditFinancing = paypalAccountNonce.getCreditFinancing();
    if (creditFinancing != null) {
      // PayPal Credit was accepted
    }

    // 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();
  }
  // Send nonce to server
  String nonce = paymentMethodNonce.getNonce();
}

PayPal and PayPal Credit with the Checkout flowanchor

Here is an example of a Checkout flow integration with both PayPal and PayPal Credit buttons:

  1. Java
//-- PayPal Button --
paypalButton.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View view) {
    PayPalRequest request = new PayPalRequest("10.00")
      .currencyCode("USD")
    PayPal.requestOneTimePayment(mBraintreeFragment, request);
  }
}

//-- PayPal Credit Button --
paypalCreditButton.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View view) {
    PayPalRequest request = new PayPalRequest("10.00")
      .currencyCode("USD")
      .offerCredit(true); // Offer PayPal Credit
    PayPal.requestOneTimePayment(mBraintreeFragment, request);
  }
}

When you receive a callback in onPaymentMethodNonceCreated, you can query the PayPalAccountNonce object you get back for specific customer information.

  1. Java
public void onPaymentMethodNonceCreated(PaymentMethodNonce paymentMethodNonce) {
  if (paymentMethodNonce instanceof PayPalAccountNonce) {
    PayPalAccountNonce paypalAccountNonce = (PayPalAccountNonce) paymentMethodNonce;

    PayPalCreditFinancing creditFinancing = paypalAccountNonce.getCreditFinancing();
    if (creditFinancing != null) {
      // PayPal Credit was accepted
    }

    // 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();
  }
  // Send nonce to server
  String nonce = paymentMethodNonce.getNonce();
}

See also


Next Page: Server-side