Product Integration Documentation

Learn how to integrate your products with SubscriptionPro to let the user manage their plans from a single platform.

Getting Started

Welcome to SubscriptionPro, Unlock recurring savings and never pay full price again! This documentation will guide digital service providers through the process of integrating your products with SubscriptionPro to offer a seamless experience to users.

Integration Flow

1. Create a Merchant Account

Visit SubscriptionPro and sign up as a merchant.

Production Server:

BASEURL: https://customer.subscriptionpro.co/api/v1/

 

SubscriptionPro merchant registration

2. Complete Merchant Profile

After signing in, navigate to the profile page (click the top right corner profile icon) to provide basic company information, including name, logo, description, phone, and email.

SubscriptionPro merchant profile

3. Get API Token Key

On the profile page under the settings section, find your token_key. This key will be used to make API requests to SubscriptionPro and authorize incoming requests from SubscriptonPro to your webhook.

Note: Use API keys to authenticate API requests

SubscriptionPro merchant API Token

4. Product Integration

Click on the “Products” menu from the left sidebar and click on “Add new” and fill in the required information, including product name, logo, webhook URL, and connection page URL.

Product Unique ID: It should be a unique id/code that can be used to identify your specific product even if you have multiple products. It should be unique for each product.

Suggestion: Your company name’s shortcode + Your product’s 3-5 character shortcode + Product released date (year’s last two digits + month’s last two digits)

Example: spwpa2311

Webhook: This is the endpoint where SubscriptionPro will send all kinds of notifications based on the user’s action.

Integration Page URL: This will be the URL of the page at which the user will be redirected once they click on the connect button along with some params like product_identifier, user_token and you can authenticate the user and send the user’s subscription info to us)

Suggestion: This is your application’s page, where users will be able to see to allow SubscriptionPro to connect.

There will be two options, one is allow and another would be cancel or disallow.

Example: https://app.wpannouncement.com/subscriptionpro/connect

Note: After successful integration, inform SubscriptionPro to review your integration. To review your application, share test credentials.

SubscriptionPro will review and approve your product, making it visible to users.

SubscriptionPro merchant product setup

5. HTTP Status and Error Codes

Learn more about error codes and how to resolve them.

Note: We follow standard HTTP status codes to handle errors and responses.

Code Name
200 OK
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error
502 Bad Gateway
503 Service Unavailable
504 Gateway Timeout

6. Data Types

Param Type Example
access_token string OYraftTragaergPfcCixg5w5eR
user_token string ZXlKcGRpSTZJbGhIU1ZoaGEydEtSMlZZTlhS...
product_identifier string wpatr234 (lowercase)
plan_id integer 26
plan_type string monthly/yearly (lowercase - no space allowed)
price float 54.98 (USD amount)
status string active/inactive (lowercase)
started_at datetime 2023-11-11 16:29:50 (24 hours - YYYY-MM-DD HH:MM:SS)
expire_at datetime 2023-11-11 16:29:50 (24 hours - YYYY-MM-DD HH:MM:SS)
api-key string ZXlKcGRpSTZJbGhIU1ZoaGEydEtSMlZZTlhS...
amount float 65.00 (USD amount)
transaction_id big integer 123456

7. Handle Webhooks

Implement a webhook for the endpoint that you provided during product addition on your platform to listen for SubscriptionPro events, such as new payment notifications. Handle these events to extend user licenses or perform other necessary actions like storing the payment records or other activities.
If you have multiple products then you can use the same webhook to handle all the events for all the products using the product_identifier (Product Unique ID) that will come along with the request data.

8. Connect User Account

When a user clicks “Connect” on SubscriptionPro (Customer Portal, Product Connect), we will redirect them to your platform’s URL that you provided during product integration with the following parameters:
user_token: User’s unique identifier (You don’t need to generate it. It’s our application’s user identifier).

product_identifier: Your unique Product ID to differentiate between multiple products.

Quick Video Guide

After validating the user’s authentication and retrieving their subscription info, send subscription data to SubscriptionPro using a POST request to BASEURL + Route in the following format (Make sure to stop auto-renewal from your platform since the user will manage it from SubscriptionPro)

Important: You should send us the data followed by the same format (below) once any changes happen on your side like the user has changed his plan (upgrade/downgrade), cancel the subscription, etc.
Request

Header:
api-key: <your token_key> Get it from your merchant profile

Method: POST

Route: order/product

Complete Endpoint: https://customer.subscriptionpro.co/api/v1/order/product

Body
{
    "access_token": "your_generated_access_token",
  
    "user_token": "user_token from the url params",
  
    "product_identifier": "product_identifier",
  
    "plan_id": "plan_id",
  
    "plan_type": "plan_type",
  
    "price": "price in USD",
  
    "status": "active",
  
    "started_at": "started_at",
  
    "expire_at": "expire_at"
              
}

9. Receive User's Payment Notifications

Once a user pays through SubscriptionPro, you will receive a POST request to your provided webhook endpoint. Use the token_key in the header to verify the request. Extend the user’s expiration date or update the subscription based on the received data. The request will contain the data in the following format…
Request

Header:
api-key: <your token_key> Get it from your merchant profile

Method: POST

Route: Your webhook URL

Complete Endpoint: https://app.wpannouncement.com/subscriptionpro/notify

Body
{
    "access_token": "your_generated_access_token",
    "product_identifier": "product_identifier",
    "amount": "amount in USD",
    "transaction_id" : "User’s payment id"
}

10. Reconciliation

Monitor the SubscriptionPro dashboard to track subscription amounts for your users. Withdraw these amounts from your merchant account within SubscriptionPro.

That’s it! You’re now integrated with SubscriptionPro, offering users a centralized platform for managing their subscriptions. For any further assistance, contact our support team at rasel@subscriptionpro.xyz