How do I integrate PayPal with Conjured Subscriptions?

To integrate PayPal as an option for your subscribers to pay with, you'll need to integrate Braintree, which powers the PayPal payment option.

Start by going to your Braintree dashboard and select the Settings > API option from the menu in the upper right hand corner.

Click the "Generate New API Key". Copy the public key, the private key, and your Merchant ID (which can be found further down on the page under "Client-Side Encryption Keys"), and head over to the Settings > General page within Conjured Subscriptions. Next to the "Braintree Integration" section, click "Enable", enter your public key, private key, and Merchant ID in the boxes provided.

*NOTE: If you're on your development store and would prefer to run test transactions instead of actually charging credit cards, simply change the environment drop-down to "Sandbox".

If your Braintree account processes transactions in multiple currencies, you'll need to also enter your Merchant Account ID. This value is *only* required if your Braintree account has multiple merchant accounts attached. Braintree's documentation describes your Merchant Account ID as follows:

While merchant account ID and merchant ID sound similar, they are different values with distinct purposes, and are often confused with one another.

Your merchant ID is a unique identifier for your entire gateway account and one of the four API credentials. This value is required for certain actions, such as connecting your API calls to the Braintree gateway or setting up third-party shopping carts.

Your merchant account ID is a unique identifier for a specific merchant account in your gateway. It is used to specify which merchant account to use when creating a transaction, creating a subscription, verifying a payment method, or generating a client token.

To find your Merchant Account ID, go to Settings > Business within your Braintree dashboard, and scroll down to the section titled "Merchant Account". Find the Merchant Account ID you'd like to use, and enter that into Conjured Subscriptions.

Finally, scroll up to the Payment Options section, and set "PayPal Payments" to Braintree.

Save your changes at the bottom of the page.

After you've added Braintree as your paypal payment option, you'll need to update both the Checkout page, the Manage Billing/Shipping page, and anywhere else you might be collecting credit card information (such as the Account Dashboard page). 

The first thing we recommend is to take a backup of your page styles to make sure you can roll back your changes in case you have any trouble. Even better, test this implementation on your development site first

Once you've taken your backup, go to Settings > Page Styles within Conjured Subscriptions, and find the section of your code where the payment should be displayed. Add the following fields:

<div data-paypal-selected>
  <p>Click "Connect" below to link your PayPal account.<br />You will still be able to review your order before you are charged.</p>
  <button type="button" id="paypal-button" data-trigger-paypal>Connect</button>
</div>
<div data-paypal-active>
  <p>Paypal Account Connected: <span data-paypal-email></span></p>
  <button type="button" id="switch-paypal-button" data-trigger-paypal>Change PayPal</button>
</div>

We've provided suggested text in the code above, but feel free to modify it and any of the styles. Just make sure to leave all the "data" parameters in place.

If you're also using a credit card processor, you might want to give your subscribers the option of choosing between using PayPal or a credit card. In that case, you'd want to add the following code to hide both the PayPal and credit card fields, and display them only when the subscriber selects which method of payment they want to use.

<style type="text/css">
  [data-paypal-selected],
  [data-paypal-active],
  [data-creditcard-selected] {
    display: none;
  }
</style>
 
<div>
  <input type="radio" name="payment" id="payment_creditcard" value="creditcard" onClick="changePaymentType(this);" />
  <label for="payment_creditcard">Pay by credit card</label>
</div>
<div>
  <input type="radio" name="payment" id="payment_paypal" value="paypal" onClick="changePaymentType(this);" />
  <label for="payment_paypal">Pay with PayPal</label>
</div>

<script type="text/javascript">
  function changePaymentType(radio) {
    document.querySelectorAll('[data-paypal-selected]').style.display = "none";
    document.querySelectorAll('[data-creditcard-selected]').style.display = "none";
    document.querySelectorAll('[data-' + radio.value + '-selected]').style.display = "block";
  }
</script>

That's all there is to it - Braintree should now function as your PayPal processor. If you have any trouble with the implementation, don't hesitate to reach out to us at support@conjured.co.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us