Refer new merchants

This integration is for signing up new merchants only. If, in addition, you want merchants to be able to take payments in your application, choose a different integration path.

As an AffiniPay partner, you can refer potential new merchants by incorporating a button for our branded sign-up flow into your application. When a user clicks the button, they are redirected to our site, where they can apply to be an AffiniPay, ClientPay, CPACharge, or LawPay merchant.

To complete this integration, you will:

  1. Obtain an OAuth token for authorization.
  2. Incorporate a Sign-Up button.
  3. Start the Sign-Up flow.
  4. Configure a webhook to confirm provisioning.

1: Obtain an OAuth token for authorization

You need an OAuth token to submit information to the branded sign-up flow.

Configure your partner OAuth application

Your partner OAuth application has details you’ll need for the OAuth token.

To configure your partner OAuth application:

  1. Log in to the web application that corresponds to the product you’re integrating into your application.
  2. In the web application, click your name in the top-right corner and click Developers. (This part of the web application is available only to users with the Administrator or Developer role and to the merchant owner.)

  3. The My Partner Applications section on the right lists your partner OAuth applications. Locate the partner OAuth application that corresponds to your application and click Edit.

    app Note: If you don’t see any partner OAuth applications, ask AffiniPay Support to create one for you.
  4. Set the application name. For current merchants, this is the name your customers see when they authorize your partner OAuth application to interact with their AffiniPay, ClientPay, CPACharge, or LawPay account.
  5. Ensure that OAuth Enabled is selected. OAuth is required for all integrations. Do not uncheck this checkbox.
  6. Set the Redirect URI. Per the OAuth 2.0 specification, the Redirect URI is the URI to which the AffiniPay, ClientPay, CPACharge, or LawPay web application will redirect after successful authorization. Your web server must handle redirects to this URI.

  7. Set the Event URL, which is the endpoint on your server to which AffiniPay sends notifications and event details, such as merchant application disposition.

Run the OAuth client credentials flow

Before you can submit information to our branded sign-up flow, you must use the OAuth client credentials flow to request an access_token. This access_token will provide you access to the necessary API resources.

Download an OAuth client library (such as one of these https://oauth.net/code/) and configure it using the following values:

Your OAuth client library should provide a convenient way to send a POST request with the these parameters to the https://api.affinipay.com/oauth/token endpoint:

Example request
curl -X POST -H "Content-Type:application/json" https://api.affinipay.com/oauth/token -d '
{
  "client_id":"Y4QLWPO6wZag2ia8Abw7nbeLUAOgebDlfZGF1KyzgBaqAllzMtYFfP58jRxg5rp5",
  "client_secret":"4EG357enIs4m2SWKi9yfC3fQzIeOZmBTWr96ay47tqN4GUtRPYrWwxwCxwlZJbiC",
  "grant_type":"client_credentials",
  "scope":"tenant"
}'
Example response
{
  "access_token":"IE83NL7SEGbLxT8UBWww78CSREhLsg5Yhf5fFu8znSpPh2BbBMvXPyQkZx5BU10C",
  "token_type":"bearer",
  "scope":"tenant",
  "created_at":1550789541
}

Use this access token to start the sign-up flow.

2: Incorporate a Sign-Up button

Add a button to your application that users will click to initiate the sign-up flow. The button must include:

For example:

Sign Up with AffiniPay

Sign Up with CPACharge

Sign Up with ClientPay

Sign Up with LawPay

3: Start the sign-up flow

To start the branded sign-up flow, POST the following information to the appropriate brand-specific endpoint:

In addition, you can POST user and business information that you already have in your application. This data will pre-populate the sign-up flow, so the user will not have to enter it themselves.

Brand-specific endpoints include:

The POST returns a redirect URI for a page that is specific to you (the partner), the user, and the brand and is available for five minutes and for one-time use only. Send users to this page, where they must start the brand-specific merchant application sign-up flow, fill in any required information that has not been pre-populated, and submit their application. Afterward, they will be redirected to a thank you page.

Click here to see an example.

4: Configure a webhook to confirm provisioning

As soon as AffiniPay determines whether the application is approved or declined, we’ll send an event to the redirect URL you specified in your partner OAuth application. Configure a webhook to watch for this event.

Event details include the reference used in the POST to /v1/merchant_applications/sign_up.

Test the sign-up flow and webhooks

To test the sign-up flow and webhooks, submit an application.

  1. Send a note to AffiniPay Dev Support to let us know that you will be testing your integration.
  2. Start the sign-up flow and submit a merchant application that includes <Partner-Name> - TEST as the business name. For example, if the partner’s name is Arden Associates, the business name for the application is Arden Associates - TEST.
  3. AffiniPay Dev Support will provision the application, which will fire the webhook. Then, they will delete this test merchant.

DO NOT submit multiple applications. Instead, use this test as a final check of the sign-up portion of your integration.