PayPal Here on Braintreeanchor

PayPal Here on Braintree enables you to add physical cards and in-person payment methods to your Braintree Vault, view PayPal Here transactions in your Braintree Control Panel, and interact with them via the Braintree API.

Onboardinganchor

PayPal and PayPal Hereanchor

  1. Have a PayPal Business Account. Note: If you currently process PayPal payments with Braintree, this will already be complete.
  2. Sign up for PayPal Here and acquire a PayPal Here card reader.
  3. Set up your preferred in-store UI for PayPal Here.
    • The simplest option is to use the PayPal Here app for iOS or Android
    • Alternatively, you can use the PayPal Here SDK to build out a custom application to accept card payments in-store.
      • This option is required in order to save in-store cards in the Braintree Vault.
      • Adding cards to the Braintree Vault with PayPal Here is currently only available for US merchants.

Braintreeanchor

  1. Log into the Control Panel
  2. Enter your PayPal business account credentials in the Braintree Control Panel. Note: If you currently process PayPal payments with Braintree, this will already be complete.
  3. Click on the gear icon in the top right corner
  4. Click Processing from the drop-down menu
  5. Scroll to the In Store section
  6. Next to PayPal Here, click the Enable button

Capabilitiesanchor

Once you've completed the onboarding steps above, you'll be able to use the Braintree Control Panel or API to do the following with PayPal Here transactions:

If you want to save cards in the Braintree Vault with PayPal Here, you'll also need to update your PayPal Here SDK integration.

Accessing transaction informationanchor

PayPal Here transactions will show up like other transactions in the Braintree gateway. In the Control Panel, they'll include a PayPal Here logo and the last 4 digits of the card used for the transaction.

In the API, transactions will have a payment_instrument_type of paypal_here and include paypal_here_details.

Vaulting cardsanchor

availability

Adding cards to the Braintree vault with PayPal Here is currently only supported in the US

The PayPal Here SDK allows for an integrating app to accept in-person payments, as well as save payment methods in the Braintree vault for later use. There are essentially two steps to enabling the Braintree functionality within the PayPal Here SDK:

  1. Enable PayPal Here on Braintree in the Control Panel.
  2. Obtain the client ID and secret from the PayPal REST app linked to your Braintree account.
important

In order to use the vaulting features, you must use the client ID and secret from the Braintree-linked PayPal REST app to generate the access token used within the PayPal Here SDK.

The steps are outlined below, and specific code samples are available for reference in the iOS and Android sample apps.

Obtaining client credentialsanchor

  1. Log into the PayPal developer portal and navigate to Apps and Credentials.
  2. Locate the REST API app that matches your Braintree account's company name and click it to view details.
  3. Click Live on the toggle in the upper right-hand corner.
  4. Client ID will be displayed under Live API Credentials.
  5. Click Show under Secret to display the client secret.
  6. Ensure that the PayPal Here box is checked under Live App Settings.

These credentials are used to get an access token that allows you to make calls to the PayPal REST API.

Vaulting a cardanchor

important

The following reference and code samples are for your PayPal Here SDK integration.

To use the Braintree vault, there are some additional options to set on the PPRetailTransactionBeginOptions used to create a payment. Keep in mind that these are in addition to any other options that are set for your normal SDK integration. There are three options that need to be set:

OptionTypeExplanation
vaultProviderENUM'braintree' indicates that payment information is being stored in the Braintree vault.
vaultCustomerIdSTRINGBraintree customer ID to vault the credit card against.
vaultTypeENUMpayOnly, vaultOnly, or payAndVault to take the payment without vaulting, vault the card without taking payment, or both take payment and vault the card.

When vaulting a card, there is a separate vaultCompletedHandler that should be registered to interrogate the result for success or failure:

  1. Swift
private func acceptVaultOnlyTransaction(
  error: PPRetailError?,
  tc: PPRetailTransactionContext?) {

  guard let tc = tc else { return }

  transactionContext = tc

  tc.setVaultCompletedHandler() { (error, vaultRecord) in
    if let error = error {
      print("debug ID: (error?.debugId)")
      print("error code: (error?.code)")
      print("dev message: (error?.developerMessage)")
    }
    if let vaultRecord = vaultRecord {
      print("vault ID: (vaultRecord?.vaultId)")
      print("vault card: (vaultRecord?.card)")
      print("valid until: (vaultRecord?.validUntil)")
    }
  }
  tc.beginPayment(options)
}

It is important to note that when simultaneously accepting a payment and vaulting the card, an error when vaulting does not necessarily mean there was an error accepting payment. If there is an error with the vaultRecord, the payment may have succeeded and should be verified separately.

When vaulting a card without a payment, there is an extra helper method createVaultTransaction on the TransactionManager. This enables you to skip the standard PayPal Here transaction flow and streamline collection of vaulted payment methods:

  1. Swift
private func doVaultOnly() {
   PayPalRetailSDK.transactionManager().createVaultTransaction() { (error, transactionContext) in
       // handle error and transaction context
   }
}

Contactanchor

If you have further questions about PayPal Here, reach out to PayPal directly.