Single endpoint to create customer (or link an existing one), subscription and invoice
Please note that the subscription you create through this method will pick up the configurations that you have done in the Payments Flow app. Please go to the following link to setup your configurations:
https://{{domain_name}}.subscriptionflow.com/en/apps/paymentsflow
Subscription Configurations:
On this page, follow these steps to set your subscription configurations:
1. Click on 'Web Checkout'.
2. Click on 'Rules and configurations'.
3. In the 'Subscription configurations' tab you will make all your subscription configurations.
4. You can create a configuration for all your plans or choose a specific plan and save a configuration accordingly.
Once you have these setup you can now use the API to create subscriptions which will follow the configurations you have just done.
API Details for Subscription Creation:
Following are the API details and examples you can follow:
End Point Details:
https:// {{domain_name}}.subscriptionflow.com/api/v1/subscriptions/checkout
Complete API Docs:
https://{{domain_name}}.subscriptionflow.com/api/documentation
Complete CURL example:
-
If customer does not exist:
curl --location 'https:// reliablepbx.subscriptionflow.com/api/v1/subscriptions/checkout' \
--header 'Authorization: Bearer {{token}}' \
--form 'first_name="John"' \
--form 'last_name="Doe"' \
--form 'mailto:email="dummyemail@sf.com"' \
--form 'line_items[0][product_id]="04d9bb5f-23ef-41be-aa1a-d19245758bcd"' \
--form 'line_items[0][plan_id]="6abc1bda-004a-4ab2-b6fe-e6472fc420dc"' \
-
If customer already exists:
curl --location 'https://test.subscriptionflow.com/api/v1/subscriptions/checkout' \
--header 'Authorization: Bearer {{token}}' \
--form 'line_items[0][product_id]="04d9bb5f-23ef-41be-aa1a-d19245758bcd"' \
--form 'line_items[0][plan_id]="6abc1bda-004a-4ab2-b6fe-e6472fc420dc"' \
--form 'customer_id="aeca5e0a-555e-4c60-be6d-72be57ac3510"
Get your Auth Tokens
Request for getting Bearer Token can be made after getting the client ID and client secret from your account by going to the link here.
curl --location 'https://{{your_domain}}.subscriptionflow.com/oauth/token' \
--form 'client_id="{{your_client_id}}"' \
--form 'client_secret="{{your_client_secret}}"' \
--form 'grant_type="client_credentials"'
How to get Product and Plan ID’s
Please follow the steps to fetch Product and Plan ID
Step 1: Navigate to the products module and click any one of the products listed.
Step 2: Highlighted text in the URL is the product ID
Step 3: In order to fetch the plan ID, click the name of the plan as shown in the screenshot below
Step 4: Highlighted text in the URL is the plan ID
Test Cases Details
Case 1: missing param line Items → Passed
Case 2: missing value line Items: → Passed
Case 3: With params → Passed
Case 4: Passing ID instead of username and email → Passed
Case 5: Passing customer ID with name and email. → Passed
Case 6: Passing wrong email with full name and customer ID → Passed
Test Response
If you want to view the response of these tests please click here to download the json file:
Conversion Tracking Configurations:
Conversion Tracking is used to redirect your customer after they have successfully subscribed.
Please note that the subscription you create through this method will pick up the configurations that you have done in the Payments Flow app. Please go to the following link to setup your configurations:
https://{{domain_name}}.subscriptionflow.com/en/apps/paymentsflow/hosted-pages/configurations?fullview=true
On this page, follow these steps to set your conversion tracking configurations:
1. Click on the Conversion Tracking Configurations tab:
2. Please read the instructions for the redirect flow and add the links you want your customer to redirect to incase of successful, pending and failed payments. You can also redirect them in case of a trial subscription or a pending subscription (usually in cases where you take offline payments or future payments, pending subscriptions are created.)
If you have any questions feel free to reach out to us at support@subscriptionflow.com and our team will be happy to assist you in setting up.
Comments
0 comments
Please sign in to leave a comment.