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:
- Obtain an OAuth token for authorization.
- Incorporate a Sign-Up button.
- Start the Sign-Up flow.
- 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:
- Log in to the web application that corresponds to the product you’re integrating into your application.
- For AffiniPay: https://secure.affinipay.com/login
- For ClientPay: https://secure.clientpay.com/login
- For CPACharge: https://secure.cpacharge.com/login
- For LawPay: https://secure.lawpay.com/login
- 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.)
- 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.
Note: If you don’t see any partner OAuth applications, ask AffiniPay Support to create one for you. - 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.
- Ensure that OAuth Enabled is selected. OAuth is required for all integrations. Do not uncheck this checkbox.
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.
- 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:
- OAuth Client ID (from your partner OAuth application)
- OAuth Secret (from your partner OAuth application)
- Scope: tenant
- Grant Type: client_credentials
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:
- An AffiniPay logo
- Use the logo that corresponds to the AffiniPay payment solution you’ve integrated with your application. Click here to download our logos.
- Scale buttons and logos to meet your size requirements, but make sure the aspect ratio is locked to prevent stretching or otherwise distorting the logo.
- “Sign Up with” text. Use the text “Sign Up with…” and append it with “AffiniPay”, “ClientPay”, “CPACharge”, or “LawPay”.
For example:
3: Start the sign-up flow
To start the branded sign-up flow, POST the following information to the appropriate brand-specific endpoint:
reference
. The unique ID for the user in your application.email
. The user’s email.plan
. The identifier for your plan within the AffiniPay system. We will create this plan for you and provide you the correct ID to use.
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:
- For AffiniPay: https://secure.affinipay.com/api/v1/merchant_applications/sign_up
- For ClientPay: https://secure.clientpay.com/api/v1/merchant_applications/sign_up
- For CPACharge: https://secure.cpacharge.com/api/v1/merchant_applications/sign_up
- For LawPay: https://secure.lawpay.com/api/v1/merchant_applications/sign_up
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.
- Send a note to AffiniPay Dev Support to let us know that you will be testing your integration.
- 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 isArden Associates
, the business name for the application isArden Associates - TEST
. - 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.