1 min read

PayPal

Starting at version 22.0, the Poq SDK offers the PayPal integration. To start accepting payments with PayPal, you need to:

  1. Include the PayPal module into your build.gradle.
    implementation ("com.poqstudio:checkout.paypal:$VERSION_NAME")
  2. Configure the returnUrl in the PayPal Dashboard Portal. The returnUrl is created from your ApplicationId as {Application Id}://paypalpay. If your ApplicationId contains upper case letters or any special character, you will need to customize the returnUrl.
  3. The PayPal Poq SDK is configurable via a PoqSetting called PayPalSettings where you can configure:
    • clientId: you can retrieve it from the PayPal Dashboard Portal.
    • environment: environment to use. It accepts two values:
      • Environment.SANDBOX: for development environments.
      • Environment.LIVE: for production environment.
  4. Include the PoqPayPalButton into your layout:
    <com.poqstudio.platform.view.checkout.paypal.ui.PoqPayPalButton
    android:id="@+id/checkout_paypal_button"
    android:layout_width="0dp"
    android:layout_height="wrap_content" />
Your app is now ready to accepts PayPal payments.

Customize returnUrl

If your ApplicationId contains upper case letters or special characters, you will need to customize the returnUrl. To do so, you need to:

  1. Override PayPalCheckoutConfigFactory and provide your custom returnUrl.
  2. Follow the PayPal documentation to customise the returnUrl.

Button styles

You can configure the style of the PoqPayPalButton through the parameter app:payPalButtonLayout. It accepts these values: to the PoqPayPalButton object from your XML layout you will be able to change the button color, possible values are:

  • gold (default value)
  • blue
  • silver
  • white
  • black

PoqPayPalButton styles on Cart
PoqPayPalButton styles on Cart

Poq Settings

The Paypal SDK is configurable via PayPalSettings. Through PayPalSettings you can configure:

  • clientId: Paypal client id.
  • environment: environment to use. Default value Environment.SANDBOX.
  • orderIntentType: the order Intent to either capture payment immediately or authorize a payment for an order after order creation. Default value OrderIntent.AUTHORIZE.