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 merchant site customer accounts.

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:

Set up your development environment

Before you can integrate Assisted Account Creation (AAC), you must:

  1. Set up your development environment. After you get a token that lets you access protected REST API resources, you create sandbox accounts to test your web and mobile apps. For details, see Get Started.

  2. To enable identity services, communicate with your PayPal contact.

    Your PayPal contact 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.

    Click Advanced Options and select Email address and Account status (verified).

    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.

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

Then, return to this page to integrate AAC.

Integration

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.

Client-side integration

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>

You can also use React or Angular to integrate AAC into your client-side application.

Integrate AAC with React

To integrate AAC into a React codebase, use this script:

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} />
      );
  }
}

Integrate AAC with Angular

To integrate AAC into an Angular codebase, use this script:

// 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 dasherized prop names):
<payouts-aac client-id={clientIds} merchant-id="<Merchant Account ID>" env=" sandbox/production" page-type=" signup/login" on-login={onLogin}/>

Server-side integration

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"

You can also integrate AAC on the server side with Node or Python.

PayPal Node SDK

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

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);
});

PayPal Python SDK

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

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()
Feedback