Custom customer portal tutorials

You can use Postman to create a demo customer portal using a test Recharge Environment and pre-configured test Collections. Use the following tutorials to practice using the Recharge API and create a demo customer portal.

🚧

Warning

You must use a test customer account in Recharge with at least one active subscription to complete these tutorials. A test customer account is needed because you will be editing and changing your test customer's subscription(s).


Tutorial 1 - Create your Recharge Environment and retrieve subscriptions

In this tutorial, you will set up the test Recharge Environment in Postman and retrieve your store's subscriptions using the API. This tutorial should make you comfortable using the Recharge API before creating a customer portal.

Step 1 - Set up the Recharge Environment in Postman

  1. Download the Recharge Environment Configuration.
  2. Download the Lab 1 Collection.
  3. Launch Postman and click Import.
  4. Locate and upload the Recharge Environment.postman_environment.json file.
  5. Click Import to finish uploading the Recharge Environment file.
  6. From Postman's main page, click Import again.
  7. Locate and upload the Recharge API- Lab 1.postman_collection.json file.
  8. Click Import to finish uploading the Lab 1 Collection.

Step 2 - Create an API token

  1. From the Recharge merchant portal, click Apps and select API tokens.
  2. Click Create an API token.
  3. Name the token Test for Postman, provide your email address, and set the scopes for all permissions to Read and Write, if available, or Read if not available.
  4. Agree to Recharge's API Terms of Service and click Save.
  5. Click Yes, grant access and copy the API token to your clipboard.

Step 3 - Update the Postman Environment

  1. In Postman, click on the Environment drop-down menu and select Recharge Environment.
16641664
  1. Click on the Environment quick look icon and click Edit.
548548
  1. Paste your Recharge API token under Current Value and click Save.

Step 4 - Use GET to retrieve subscriptions

  1. Open the Recharge API: Lab 1 Collection and click List Subscriptions.
  2. Click Headers and review the API Token and API Version. Ensure your API Token is correct and the API Version is set to 2021-11.
  3. Click Send and verify the GET call was successful.
  4. Open the Recharge API: Lab 1 Collection and click List Subscriptions with include.
  5. Click Send.
  6. Compare your results to the first GET call. The second call should include customer information.
  7. Continue executing other API calls in this Collection for more practice or move on to the next tutorial.

Tutorial 2 - Create a customer portal using the Recharge API

In this tutorial, you will use a pre-configured test Collection and test customer account to create a customer portal using the Recharge API. After completing this tutorial, you should understand the basics of creating a custom customer portal.

Step 1 - Recharge Environment configuration

  1. Download the Lab 2 Collection.
  2. Launch Postman and click Import.
  3. Locate and upload the Recharge API- Lab 2.postman_collection.json file.
  4. Click Import to finish uploading the Recharge Environment file.

Step 2 - Retrieve customer by hash

  1. From the Recharge merchant portal, click Customers and open a test customer's account.
  2. From the test customer's profile, click Customer portal links and copy the Subscriptions link.
  3. Paste the URL in a text file or notepad.
  4. Locate the customer_hash. The customer_hash is located between portal/ and /subscriptions/ in the URL.
  5. Copy the customer_hash value.
  6. Launch Postman and from the Environment drop-down choose Recharge Environment.
  7. Click on the Environment quick look icon and click Edit.
  8. Locate the hash_id variable and paste the customer_hash value under Current Value.
  9. Click Save.
  10. Open the Recharge API: Lab 2 Collection and click List Customer by hash.
  11. Click Send.
  12. Verify the GET call was successful.
  13. Locate and highlight the id in the response body.
  14. Right-click the highlighted id and click Set: Recharge Environment > customer_id.
  15. You have now retrieved the customer_id and set the customer_id variable by using the customer_hash.

Step 3 - Retrieve customer subscriptions by customer_id

  1. From the Recharge API: Lab 2 Collection, click List Subscriptions by Customer.
  2. Click Send.
  3. Review the JSON response. All the subscriptions for the customer should be listed.
  4. Locate and highlight the id in the response body.
  5. Right-click the highlighted id and click Set: Recharge Environment > subscription_id.

Step 4 - Retrieve customer delivery schedule

  1. From the Recharge API: Lab 2 Collection, click List Customer Delivery Schedule.
  2. Click Send.
  3. Review the JSON response. The delivery schedule for the customer's subscriptions should be listed.
  4. Locate and highlight the charge_id in the response body.
  5. Right-click the highlighted charge_id and click Set: Recharge Environment > charge_id.

Step 5 - Add a filter to customer delivery schedule

  1. From the Recharge API: Lab 2 Collection, click List Customer Delivery Schedule.
  2. Edit the GET line in Postman and add the ?future_interval=10 filter. This will return all scheduled deliveries for the next 10 days.
13401340
  1. Click Send.
  2. Review the JSON response. You can add additional filters that you might find useful in a customer portal. Refer to the Recharge API Reference for an explanation of these attributes.

Step 6 - Skip next order

  1. From the Recharge API: Lab 2 Collection, click Skip upcoming order.
  2. Click Send.
  3. Review the JSON response. You should see that you skipped the next order for this subscription. To verify this, check the customer's account from the Recharge merchant portal.

Step 7 - Update frequency

  1. From the Recharge API: Lab 2 Collection, click Update Subscription Frequency.
  2. Click Body and set the following:
  • order_interval_unit: "week"
  • order_interval_frequency: 1
  • charge_interval_frequency: 1
  1. Click Send.
  2. Review the JSON response. You should have changed this subscription's frequency to once per week.

Need Help? Contact Us