payouts

Set up Assisted Account Creation

To simplify payouts, Assisted Account Creation (AAC) enables customers to use their PayPal account to log in or sign up to a merchant site. This can accelerate and increase creation of customer accounts on the merchant site.

The merchant receives the payer ID and email address of each customer who completes the onboarding flow. Barring compliance or fraud issues, payer IDs are the most reliable way to send payouts.

AAC can also:

  • Identify users with PayPal accounts and display a Connect with PayPal button.
  • Enable merchants to customize rewards for PayPal users.
  • Enable customers to connect their PayPal account at the merchant site's payment settings screen.

Use AAC with these payouts integration methods:

AAC Prerequisites

Before you integrate AAC, you'll need to:

  1. Be sure you get your OAuth and secret credentials. If not, get started.

  2. Contact your PayPal account manager to enable identity services.

    Your PayPal account manager adds:

    App settings Return URL
    Sandbox https://www.sandbox.paypal.com/conex/ac/add-offer-recipient
    Live https://www.paypal.com/conex/ac/add-offer-recipient
  3. In your sandbox app settings, select Connect with PayPal.

  4. Click Advanced Options and select Email address, Account status (verified), and PayPal account ID (payer ID).

    Based on your company’s requirements, you can Enable customers who have not yet confirmed their email address with PayPal to log in to your app.

    For details, see Enable Connect with PayPal.

  5. Get your merchant account ID from the Settings page of your PayPal business account.

Integrate AAC

You can use AAC to acquire customers’ email addresses and Payer IDs, which are encrypted PayPal account numbers, at sign up, log in, or payment set up on a merchant or partner website.

AAC requires client-side and server-side integration. For client-side integration, AAC uses Zoid, PayPal’s open-source cross-domain-component library. Server-side integration includes two PayPal API calls.

To integrate AAC:

  1. Integrate the AAC SDK on your client-side application.
  2. Add PayPal’s server-side API calls to your server-side application.

Integrate client side

Drop the AAC SDK onto your applicable pages as follows:

Note: In the client side scripts, information you need to fill in (for example, container, client_id, or signup/login) has quotation marks and angled brackets around it.

<!—PayPal client-side script -->
<script src="https://www.paypalobjects.com/payouts/js/payouts_aac.js"></script>

<!-- Set up a container for ACC to be rendered into -->
<div id="container"></div>

<script>
    // Render the AAC component
    paypal.PayoutsAAC.render({
        // Use sandbox for testing
        env: "<sandbox/production>",
        clientId: {
          production: "<production clientId>",
          sandbox: "<sandbox clientId>"
        },
        merchantId: "<Merchant Account ID>",
        pageType: "<signup/login>",
        onLogin: function(response) {
          if (response.err) {
            console.log(response.err)
          } else {
            console.log(response.body.code);
          }
        }
      }, '#container');
</script>

Integrate with React or Angular

Use this code to integrate AAC if your client-side application runs on React or Angular.

import React from 'react';
import ReactDOM from 'react-dom';

const AACComponent = paypal.PayoutsAAC.driver('react', {
  React,
  ReactDOM
});

class OtherReactComponent extends React.Component {
render() {
         return (
        <AACComponent
clientId="<client_id>"
merchantId="<Merchant Account ID>"
env="<sandbox/production>"
pageType="<signup/login>"
onLogin={onLogin} />
      );
  }
}
// Specify the component name as a dependency to your angular app:
angular.module('myapp', ['payouts-aac])
// Include the tag in one of your templates (don't forget to use spine case prop names):
<payouts-aac client-id={clientIds} merchant-id="<Merchant Account ID>" env="" page-type="<signup/login>" on-login={onLogin}/>

Integrate server side

Server side integration includes two PayPal API calls.

  1. Use the authorization code returned in the client side integration to obtain an access token.
curl -X POST https://api.paypal.com/v1/identity/openidconnect/tokenservice \
  -H 'Authorization: Basic <Base64 Encoded client_id:secret>' \
  -d 'grant_type=authorization_code&code code'
  1. Pass the access token from the client side integration to the server side.
  2. Use the access token to get the customer's email address and Payer ID.
curl -v -X GET https://api.paypal.com/v1/oauth2/token/userinfo?schema=openid \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer access_token"

Integrate on Node or Python

Use this code to install AAC if your server runs on Node or Python.

npm install paypal-rest-sdk

var paypal = require('paypal-rest-sdk');
paypal.configure({
  'mode': 'sandbox', //sandbox or live
  'client_id': '',
  'client_secret': ''
});
// Get tokeninfo with Authorize code
paypal.openIdConnect.tokeninfo.create("Replace with authorize code", function(error, tokeninfo){
  console.log(tokeninfo);
});
// Get userinfo with Access code
paypal.openIdConnect.userinfo.get("Replace with access_code", function(error, userinfo){
  console.log(userinfo);
});
apt-get install libssl-dev libffi-dev
pip install paypalrestsdk

import paypalrestsdk
from paypalrestsdk.openid_connect import Tokeninfo, Userinfo

paypalrestsdk.configure({
  "mode": "sandbox", # sandbox or live
  "client_id": "",
  "client_secret": "" })
tokeninfo = Tokeninfo.create("Replace with Authorize code")
userinfo  = tokeninfo.userinfo()