Oct 24, 2022
5 min read
In this guide, we will show you how to get subscriptions to your products and services up and running fast! PayPal provides a straightforward way to sell subscriptions. You shall configure your subscription plan within PayPal's sandbox environment, so that you can thoroughly test your subscription flow without any financial risk.
Once your sandbox subscription setup is working properly, you need only to duplicate the steps we took from within your PayPal Business account.
Sign into your PayPal Developer account. If you do not have one yet, sign up for a Business PayPal account, then navigate to the PayPal Developer site.
From the Developer Dashboard, you will grab the credentials for your sandbox accounts.
PayPal has automatically created 2 sandbox accounts for you: one called Business and the other Personal. The Business sandbox represents the Merchant (seller) perspective, while the Personal sandbox account represents the buyer's perspective.
For this guide, I shall refer to the Business sandbox account as the Merchant sandbox account, to avoid clashing terms with the Business-type PayPal account that grants Developer Dashboard access.
Click on the three dots to the right of each sandbox account type, then choose View/Edit account.
Copy the email and password for both sandbox accounts to a safe place for use later. Then sign out of your PayPal Developer account.
Next, you shall create both a Subscription product and plan. The product is the item/service you are selling, while the plan governs the details of your customers' subscription to your product.
Sign into PayPal's Sandbox using your Merchant sandbox account. Navigate to Pay & Get Paid => Accept Payments => Subscriptions. Select Subscription plans, then click the button Create Plan.
If you already have a subscription product, select it; else, click on Create a subscription product. For this guide, fill out just the required fields: Product name & Product type. The Product ID is filled automatically (unless you desire a specific product ID). Then choose your newly-created product on the next page:
Next, you build your Subscription Plan. For the purposes of this guide, I recommend the following features:
After configuring your subscription plan, click Turn Plan On. PayPal then generates your Subscription buttons!
đ Configure your buttons to your preferred design, then click Copy Code. This is a sample of the code you will paste in your application:
There are 2 <script> tags. The first <script> tag details the PayPal Software Developer Kit (SDK) that you are using, and contains your client-id, which the button generator inserted automatically for you:
The second <script> tag confers the buttons' functionality, and also renders your Subscribe buttons at the <div> with an id that starts paypal-button-container...:
Move this <div> to where you wish your buttons to be displayed. Just ensure that this location is on the SAME page as the two <script> tags.
Within the onApprove value in the 2nd <script> tag, you may configure the action to occur after your customers subscribe. For example, you may want to update your UI with a confirmation message. The default onApprove behavior displays an alert containing the ID of the newly-activated subscription.
Now for the fun part! đđ˝ Click on the PayPal Subscribe button within your app. A window should popup allowing you to pay with a PayPal account. Sign in with your Personal sandbox account:
You should see details of your pending subscription purchase, with options to choose either your sandbox bank account, or sandbox credit card, for payment:
Complete the checkout flow. If you left the default behavior for onApprove in place, you should see an alert popup.
To verify that your sandbox subscription purchase was successful, sign into your Personal sandbox Account in an incognito tab, using your Personal sandbox credentials. You should see that your sandbox account was debited by the cost of your subscription. Over in your Merchant sandbox account, you should also see that your balance has increased by the same amount! đĽł
To configure a PayPal Subscription Plan that accepts live payments, simply repeat the steps above using your PayPal Business account. Sign into PayPal.com (notice there is no sandbox subdomain), navigate to Pay & Get Paid => Accept Payments => Subscriptions and continue the steps as above.
Bear in mind that to test your live Subscription configuration, you would need an actual PayPal account (not the sandbox kind) and/or an actual credit/debit card. Also, the purchase will be real. I strongly recommend using your sandbox accounts to do all the testing and adjustments you wish, before going live with your subscription.
Have fun! And get that money! đ
3 min read
4 min read
9 min read