Links

Api Subscription

This Section guides you to create subscription via api payment mode.
The API subscription is compatible with all types of integration methods. If you want to skip the 3DS option, please contact Foloosi's support team.
NOTE,
A subscription can only be created when the API is set to live mode.

Basic Requirements

Steps to create subscription

To create a subscription using any type of integration, simply add the required post data to the initialize API.
1
// additional data to be passed with initialize api,
2
api_subscription : "Yes", /**NOTE- THIS FIELD MUST BE IN YES */
3
recurring_data : {
4
plan : {
5
name : "Api new plan", /** YOUR PLAN NAME*/
6
billing_type : "day", /** value must be day/week/month/year */
7
billing_cycle : 1, /** it only applicable for week and month billing type.ex Every 1 weeks */
8
billing_currency : "AED", //it should be 3 digit code and other than AED you should enabled multi currency option from Foloosi
9
billing_amount : "SUBSCRIPTION AMOUNT",
10
setup_fee : "SETUP FEE", //which is subscription setup one time fee
11
total_count : 10, //number of deductions
12
description : "daily demo plan",
13
start_date : "dd-mm-yyyy" //which is optional param.if you given value should be in the format
14
//Note : if you given date means .at the time of payment will be charged by transaction
15
//amount as you given .subscription recurring will start on the given date and given billing amount
16
},
17
customer : {
18
name : "CUSTOMER NAME",
19
email : "CUSTOMER EMAIL ID"',
20
mobile : "CUSTOMER MOBILE NO",
21
}
22
}

Sample images

After successful subscription creation, it has to be listed in Foloosi panel. Please login to view the subscription created.
Subscription list
Click the subscription id to view details like below
Subscription detail popup
To get the Transaction Details And Subscription number
For Transaction Details, you can use the Get request as below.
1
GET API LINK: https://api.foloosi.com/v1/api/transaction-detail/YOUR_TRANSACTION_ID
2
3
HEADERS:
4
secret_key : YOUR_SECRET_KEY
5
6
SAMPLE RESPONSE:
7
{
8
"message": "Transaction detail are",
9
"data": {
10
"transaction_no": "FLSXXXXXXXXXXXXXX",
11
"receipt": null,
12
"request_currency": "AED",
13
"request_amount": 18,
14
"customer_currency": "AED",
15
"customer_amount": 18,
16
"merchant_currency": null,
17
"merchant_amount": null,
18
"status": "pending",
19
"created": "2022-11-01T10:21:04+00:00",
20
"optional1": "order-id-123",\\optional fields passed on initialize api
21
"optional2": "order-reference",\\optional fields passed on initialize api
22
"optional3": "",\\optional fields passed on initialize api
23
"subscription_no": "FLSSXXXXXXXXXXXXX"
24
}
25
}
To get the Subscription Details
For Subscription Details, you can use the Get request as below,
1
GET API LINK: https://api.foloosi.com/v1/open/subscription-link/detail/YOUR_TRANSACTION_ID
2
3
HEADERS:
4
secret_key : YOUR_SECRET_KEY
5
6
SAMPLE RESPONSE:
7
{
8
"message": "Subscription details are",
9
"data": {
10
"customer": {
11
"name": "FOLOOSI CUSTOMER",
12
"email": "[email protected]",
13
"mobile": "567812345",
14
"card_last_four": "5123"
15
},
16
"plan": {
17
"name": "Mobile PostPaid",
18
"type": "Billed Every month",
19
"amount": "AED 114.60",
20
"unit": "1 x AED 114.60 per unit",
21
"setup_fee": 0,
22
"status": "active",
23
"created": "01-10-2022 02:11 am"
24
},
25
"invoices": [
26
{
27
"id": 50094,
28
"subscription_id": 1031,
29
"billing_type": "month",
30
"billing_count": 1,
31
"bill_date": "2022-11-01",
32
"status": "paid"
33
},
34
{
35
"id": 50095,
36
"subscription_id": 1031,
37
"billing_type": "month",
38
"billing_count": 1,
39
"bill_date": "2022-12-01",
40
"status": "pending"
41
}
42
]
43
}
44
}
To cancel a Subscription
NOTE : Follow any one of the methods below to cancel a subscription,
a. To cancel a Subscription with api , you can use the api given below,
1
2
PUT API LINK: https://api.foloosi.com/v1/open/subscription-link/suspend
3
4
HEADERS:
5
secret_key : YOUR_SECRET_KEY
6
7
BODY:
8
subscription_no : YOUR_SUBSCRIPTION_NO
9
10
SAMPLE RESPONSE:
11
{
12
"message": "Subscription cancelled successfully",
13
"data": {
14
"status": 200
15
}
16
}
b. You can cancel the subscription directly from foloosi panel.
  • login to foloosi panel.
  • click subscriptions under subscription category.
  • click the subscription id, it will open a popup as shown below.
cancel subscription
NOTE
Supports 170 World Currencies

Properties

List of properties available:
Name
Type
Required
Description
merchant_key
String
true
your foloosi merchant key
secret_key
String
true
your foloosi secret key
reference_token
String
false
the reference token - generates automatically if null
site_redirect_url
String
false
the url which will get payment response after payment completed.
transaction_amount
String
true
transaction amount
currency
String
true
transaction currency
customer_name
String
false
customer name - auto render in payment popup if passed
customer_email
String
false
customer email - auto render in payment popup if passed
customer_mobile
String
false
customer mobile - auto render in payment popup if passed
customer_address
String
false
customer address - auto render in payment popup if passed
customer_city
String
false
customer city - auto render in payment popup if passed
billing_state
String
false
Billing State - auto render in payment popup if passed
billing_postal_code
String
false
Billing Postcode - auto render in payment popup if passed
billing_country
String
false
Billing Country - auto render in payment popup if passed
api_subscription
String
true
It must be Yes for create subscription
recurring_data
Array
true
It contain subscription details
plan
Array
true
It must have plan detail
name
String
true
It must be string and name for the plan
biling_type
String
true
it must be day/week/month/year
billing_cycle
Integer
true
it only applicable for week and month billing type.ex Every 1 weeks
billing_currency
String
true
it should be 3 digit code and other than AED you should enabled multi currency option from Foloosi
billing_amount
Integer
true
recurring amount should be passed here
setup_fee
Integer
false
which is subscription setup one time fee
total_count
Integer
true
number of deductions in recurring
description
String
true
subscription description should be entered
start_date
String
false
which is optional param.if you given value should be in the format('dd-mm-yyyy') if you given date means .at the time of payment will be charged by transaction amount as you given .subscription recurring will start on the given date and given billing amount
customer
Array
true
It should contain customer details
name
String
true
it must be customer name
email
String
true
it must be customer email Id
mobile
Integer
true
it must be customer mobile number

Support

Visit https://www.foloosi.com for support requests or email to [email protected].

Developed by

Foloosi Technologies Pvt Ltd.

License

Copyrights (c) 2022 Foloosi