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:
- Include the PayPal module into your
build.gradle.implementation ("com.poqstudio:checkout.paypal:$VERSION_NAME") - Configure the
returnUrlin the PayPal Dashboard Portal. ThereturnUrlis created from yourApplicationIdas{Application Id}://paypalpay. If your ApplicationId contains upper case letters or any special character, you will need to customize thereturnUrl. - 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.
- Include the
PoqPayPalButtoninto your layout:<com.poqstudio.platform.view.checkout.paypal.ui.PoqPayPalButtonandroid: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:
- Override PayPalCheckoutConfigFactory and provide your custom
returnUrl. - 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)bluesilverwhiteblack
Poq Settings
The Paypal SDK is configurable via PayPalSettings.
Through PayPalSettings you can configure:
clientId: Paypal client id.environment: environment to use. Default valueEnvironment.SANDBOX.orderIntentType: the order Intent to either capture payment immediately or authorize a payment for an order after order creation. Default valueOrderIntent.AUTHORIZE.