PayPal

PayPal Pay Later Messaging

Availability

PayPal Pay Later Messaging is currently available for merchants using the latest iOS and Android SDKs. It is not currently available for merchants using the Drop-in SDK.

Note

PayPal Pay Later Messaging is available to eligible merchants in the US, GB, DE, FR, IT, ES, and AU.

You're eligible to integrate if you:

  • Are a current Braintree merchant
  • Use the latest Braintree integration
  • Are using iOS and Android SDKs to build native apps.
  • Have a one-time payment integration and Pay Later options are available via PayPal checkout.
  • Abide by the PayPal Acceptable Use Policy.
  • Do not edit Pay Later messages with additional content, wording, marketing, or other materials to encourage use of this product. PayPal reserves the right to take action in accordance with the PayPal User Agreement.

Certain categories, like Real Money Gaming, are not eligible to promote Pay Later offers. Additionally, we may periodically identify additional merchant categories that may not be eligible to promote Pay Later offers.

In this experience the SDK will offer the ability to add and integrate Pay Later messages to display customized payment offers for customers.

Get the SDKAnchorIcon

Add the following in your app-level build.gradle:

  1. Groovy
dependencies {
  implementation 'com.braintreepayments.api:paypal-messaging:5.0.0'
}

Invoking the Pay Later Messaging FlowAnchorIcon

First, create a PayPalMessagingRequest with your specified parameters. Next, create a PayPalMessagingView with your context and authorization string.

  1. Kotlin
class MainActivity : AppCompactActivity() { 

  override fun onCreate(savedInstanceState: Bundle?) { 
    super.onCreate(savedInstanceState) 
    setContentView(R.layout.activity_main)  
 
    val payPalMessageRequest = PayPalMessagingRequest( 
      amount = 100.00, 
      pageType = null, 
      logoType = PayPalMessagingLogoType.PRIMARY,
      textAlignment = PayPalMessagingTextAlignment.CENTER,
      color = PayPalMessagingColor.BLACK
    )
    
    val payPalMessageView = PayPalMessagingView( 
      context = this,
      authorization = "<#CLIENT_AUTHORIZATION#>"
    ) 

    payPalMessagingView.start(payPalMessagingRequest)
    payPalMessagingView.layoutParams = ViewGroup.LayoutParams(
      ViewGroup.LayoutParams.MATCH_PARENT,
      ViewGroup.LayoutParams.MATCH_PARENT
    )

    val messagingView: LinearLayout = view.findViewById(R.id.content)
    messagingView.addView(payPalMessagingView)
    
    // Optionally re-render an existing PayPalMessagingView by calling start() with a new request   
  } 
}
Optionally have your class use the PayPalMessagingListener interface.
  1. Kotlin
class MainActivity : PayPalMessagingListener {
  payPalMessagingView.setListener(this) 

  override fun onPayPalMessagingClick() { 
    // optionally handle selection of PayPalMessagingView
  } 

  override fun onPayPalMessagingApply() { 
    // optionally handle customers applying for an offer from the PayPalMessagingView
  } 

  override fun onPayPalMessagingLoading() { 
    // optionally handle loading of PayPalMessagingView before the view is rendered to the page
  } 

  override fun onPayPalMessagingSuccess() { 
    // optionally handle the PayPalMessagingView successfully loading and rending the view
  } 

  override fun onPayPalMessagingFailure(error: Exception) { 
    // optionally handle errors returned from the PayPalMessagingView
  } 
}

ReferenceAnchorIcon

PayPalMessagingView ClassAnchorIcon

Create a Message view by invoking the PayPalMessagingView class with the following arguments:

**Argument** **Type** **Description**
braintreeClientBraintreeClientA Braintree Client containing your client token or tokenization key
contextContextSets the application context for the view. In a Jetpack activity, this might be LocalContext.current. In a vanilla Kotlin activity, it might be the keyword this

PayPalMessagingRequest ClassAnchorIcon

Create a PayPalMessagingRequest data class by invoking the PayPalMessagingRequest with the following arguments:

**Argument** **Type** **Default**
amountAny number, up to two decimalsNone
pageTypePayPalMessagingPageType.CART

PayPalMessagingPageType.CHECKOUT

PayPalMessagingPageType.HOME

PayPalMessagingPageType.MINI_CART

PayPalMessagingPageType.PRODUCT_DETAILS

PayPalMessagingPageType.PRODUCT_LISTING

SEARCH_RESULTS

None
colorPayPalMessagingColor.BLACK

PayPalMessagingColor.WHITE

PayPalMessagingColor.MONOCHROME

PayPalMessagingColor.GRAYSCALE

PayPalMessagingColor.BLACK
logoTypePayPalMessagingLogoType.PRIMARY

PayPalMessagingLogoType.ALTERNATIVE

PayPalMessagingLogoType.INLINE

PayPalMessagingLogoType.NONE

PayPalMessagingLogoType.PRIMARY
textAlignmentPayPalMessagingTextAlignment.LEFT

PayPalMessagingTextAlignment.CENTER

PayPalMessagingTextAlignment.RIGHT

PayPalMessagingTextAlignment.LEFT

PayPalMessagingListener InterfaceAnchorIcon

Create a class that uses the PayPalMessagingListener interface to get information about Pay Later messaging lifecycle events.

**Methods** **Parameters** **Description**
onPayPalMessagingClickNoneThe message has been tapped
onPayPalMessagingApplyNoneThe user has begun a PayPal credit application
onPayPalMessagingLoadingNoneThe message started to fetch its content
onPayPalMessagingSuccessNoneThe message has rendered
onPayPalMessagingErrorerror: ExceptionAn error occurred