Braintree

The Braintree gateway built into Restrict Content Pro allows you to use your Braintree account to accept credit cards directly on your website.

Configuring Braintree

If you don't already have a Braintree account, go to https://www.braintreepayments.com and create an account.

After creating an account, follow the steps here to get started:

1. Generate an API key: https://articles.braintreepayments.com/control-panel/important-gateway-credentials#api-credentials

2. Enter both your public and private keys into the Restrict Content Pro payment settings tab under Restrict > Settings > Payments.

3. Enter your Merchant ID: https://articles.braintreepayments.com/control-panel/important-gateway-credentials#merchant-account-id

4. Enter your Client-Side Encryption (CSE) key: https://articles.braintreepayments.com/control-panel/important-gateway-credentials#client-side-encryption-(cse)-key

After entering the above information, you can start testing Restrict Content Pro with Braintree when you enable the "Use Braintree sandbox to test your transactions" option.

Note: It can take a few business days for Braintree to set up a merchant account for you.

Set up your subscription plan(s) in Braintree

Braintree requires that all recurring subscription plans be manually entered in your Braintree merchant interface. These plans contain the same pricing and duration details as your Restrict Content Pro subscription levels.

First,  create your subscription level(s) inside Restrict Content Pro, then login to your Braintree account and click "Plans" under "Recurring Billing" on the left.

Click the "New" button to create a new plan. You'll see a form that looks like this:

All the information you enter here needs to match what you've entered in your RCP subscription level, including the "Plan ID". You can find your subscription level ID in RCP by going to Restrict > Subscription Levels and hover over the subscription level. You'll see the ID number appear, like so:

In this case, I would enter "7" in the "Plan ID" box in Braintree.

Your Plan Name, Price, and Billing Cycle should also match. If you've included a free trial with your subscription level, that needs to be configured as well by checking the "Include Trial Period" box and filling out the additional information.

If you change any of this information in RCP at a later date, it also needs to be adjusted in your Braintree account.

Payment flow

With Braintree, customers will be shown a credit / debit card form directly on your registration form:

After filling in the credit / debit card details, the customer will be presented with a processing indicator. If the card is successfully charged, the customer will be redirected to the success page. If the card fails, the customer will be shown an error message.

Webhooks

Webhooks are how Restrict Content Pro communicates with Braintree and is the system RCP uses to detect when a subscription has been updated (payment made, account cancelled, etc.).

The URL that Braintree sends webhooks to must be configured manually from your Braintree Webhooks page ( Settings > Webhooks ).

Click the "Create new webhook" button to be taken to the webhook form. In the "Destination URL" field, enter your store's main web address with /index.php?listener=braintree at the end. For example: https://example.com/index.php?listener=braintree (be sure to change example.com to your own site's domain name).

Then select all notifications under the "Subscription" category, as shown below.

If you are using Braintree in sandbox mode you must also configure a webhook in your Braintree sandbox account.

Testing Braintree payment gateway

To test Restrict Content Pro with Braintree, follow these steps:

  1. If you haven't already, signup for a sandbox account here: https://www.braintreepayments.com/sandbox
  2. Enter your test merchant, public, and private keys in Restrict Content Pro > Payments. Also enter your Sandbox Client Side Encryption Key.
  3. Enable sandbox mode in Restrict Content Pro > Payments.
  4. Visit your website's registration page while logged out.
  5. Enter the user information. This can be anything, though a real email address that you have access to is advised.
  6. Choose a paid subscription level.
  7. Choose to auto renew (or not) the subscription.
  8. Choose "Credit Card" as the payment method.
  9. Enter "4111111111111111" for card number. (Other test card numbers are available here.)
  10. Enter 12 / 2020 for the expiration. Any date in the future will work.
  11. Click "Register".
  12. You should now be redirect to the success page and logged-in as your new user.
  13. Check your Braintree transaction list, you will see the test transaction. If making a recurring payment, you should also see the subscription in your Braintree subscriptions list.
  14. Your new user now has a fully activated account.