Skip to main content
SubscriptionFlow Docs
API

API Sample for Creating a Paid Subscription with an Offline Transaction

Updated

 

Although, there is no direct option to create a paid subscription. You can follow the steps below to achieve this. You'll first create a subscription for a customer whose payment status will be pending and then get the invoice of this subscription to mark it as paid offline and this will update the subscription status as paid.

Step 1: Create a subscription

  • Request Type :  Post
  • Required Parameters:
    • customer_id
    • items
    • termed_start_date
    • renewal_type

Note: based on renewal type, few necessary fields are required.

Example API Call: 

curl --location 'https://{{your_domain}}.subscriptionflow.com/api/v1/subscriptions' \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer {{your_token}}\

--data '{

    "customer_id": "9f418ee4-88c1-49a9-869b-265c16bb4ed7",

    "type": "Termed",

    "termed_start_date": "2022-08-11",

    "termed_initial_period": "1",

    "termed_initial_period_type": "Month",

    "renewal_type": "Renew with Specific Term",

    "renewal_period": "1",

    "renewal_period_type" : "Month",

    "is_auto_renew": "1",

    "trigger_dates": "2022-08-11",

    "billing_end_date": "2022-08-22",

    "order_date":"2022-08-11",

    "items": [{

 

                "plan_id": "1e51878b-2d19-4c82-a783-a43cb6d0cb23",

                "product_id": "a9278e4c-0596-4722-bf72-4b90008c31a5"

            }]

}


Screenshot: 


'

Step 2: Get Invoice of the customer

Example API Call: 


curl --location 'https://{{your_domain}}.subscriptionflow.com/api/v1/invoices/filter' \

--header 'Authorization: Bearer {{your_token}}' \

 

--form 'filter[customer_id][$equals]="9f418ee4-88c1-49a9-869b-265c16bb4ed7"'

 

Note: This will provide you all the invoices of the customer in an array. Just see which amount and corresponding data is the same as the subscription you just created to identify the one you need.

 

Screenshot:

Step 3 : Mark the Invoice as Paid

Example API Call: 

curl --location 'https://{{your_domain}}.subscriptionflow.com/api/v1/invoices/charge/offline/2316334a-aac5-40dc-9909-a47182d4f7dd' \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer {{your_token}}' \

--data '  {

    "payment_type":"Cash",

    "reference":"manual payment",

    "description":"Paid Subscription",

    "payment_status":"Paid"

}'

Screenshot: 

 

 

Was this article helpful?0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.