updated 2025-09

	**1.) Get customer latest recharge order:**

use the following base URL: 
	[**deprecated**]:
	**{shopify_store}/apps/subscribfy-api/v1/refund-api.php?cid={{ cid }}&hash={{ hash }}**
	
	*new version:* 
	***{shopify_store}/apps/subscribfy-api/v1/refund/get?cid={{ cid }}&hash={{ hash }}**

URL query params:*
**  cid:** {{customer.id}}  --> shopify customer id
  **hash:** {{customer.metafields.exison.exison_hash}}  --> subscribfy customer unique token

****Make a POST request to interact with the API. Include the following parameters in your request:
**POST Params:
  email:** {{customer email}} -- optional
  **scid:** {{customer.metafields.exison.customer_subscription1.scid}}  --> subscribfy subscription contract id
  **action:
    getLatestRechargeOrder**

exemple:
*****curl -X POST "{shopify_store}/apps/subscribfy-api/v1/refund/get?cid={{ cid }}&hash={{ hash }}" \\
-d 'scid=1234' \\
-d 'action=updateRefundContent'* 

**### Responses

The API will return JSON responses based on the request made:

- Error Responses:**
   {"error": "Bad request."}
   {"error": "Missing parameters."}
   {"error": "Subscription contract not found."}
	 {"error": "No recharge order found."}

**- Success Responses:**

	exemple 1 (**getLatestRechargeOrder**)
****	{
		"order": {
			"id": 6000000123,
			"type": "subscribfy recharge",
			"date_of_purchase": "December 3, 2023",
			"date_of_purchase_timestamp": 1701607722,
			"amount": "31.75",
			"currency_code": "USD",
			"order_name": "#123",
			"financial_status": "VOIDED",
			"refund_in_progress": true
		},
		"customer": {
			"id": "123",
			"subscribfy_store_credits_available_balance": "0.00"
		}
	}

	exemple 2 (**getLatestRechargeOrder**)
	{
	  "order": {
	    "id": 6000000123,
	    "type": "subscribfy recharge",
	    "date_of_purchase": "August 1, 2023",
	    "date_of_purchase_timestamp": 1690874477,
	    "amount": "30.80",
	    "currency_code": "USD",
	    "order_name": "#123",
	    "financial_status": "REFUNDED",
	    "dispute": {
	      "type": "inquiry",
	      "status": "won",
	      "initiated_at_timestamp": "1691376112",
	      "last_updated_timestamp": "1701077002"
	    },
	    "refund_in_progress": false
	  },
	  "customer": {
	    "id": "1000000123",
	    "subscribfy_store_credits_available_balance": "0.00"
	  }
	}

exemple 3 (**getLatestRechargeOrder**)
	{
	  "order": {
      "id": 6000000125,
      "type": "subscribfy recharge",
      "date_of_purchase": "September 1, 2025",
      "date_of_purchase_timestamp": 1756718604,
      "amount": "19.00",
      "currency_code": "USD",
      "order_name": "#1083",
      "financial_status": "REFUNDED",
      "refund_in_progress": false
	  },
	  "customer": {
	    "id": "1000000123",
	    "subscribfy_store_credits_available_balance": "29.00"
	  },
	  
  "orders": [
    {
      "id": 6000000125,
      "type": "subscribfy recharge",
      "date_of_purchase": "September 1, 2025",
      "date_of_purchase_timestamp": 1756718604,
      "amount": "19.00",
      "currency_code": "USD",
      "order_name": "#1083",
      "financial_status": "REFUNDED",
      "refund_in_progress": false
    },
    {
      "id": 6000000124,
      "type": "subscribfy recharge",
      "date_of_purchase": "August 1, 2025",
      "date_of_purchase_timestamp": 1754040000,
      "amount": "19.00",
      "currency_code": "USD",
      "order_name": "#1042",
      "financial_status": "PAID",
      "refund_in_progress": false
    },
    {
      "id": 6000000123,
      "type": "subscribfy recharge",
      "date_of_purchase": "July 1, 2025",
      "date_of_purchase_timestamp": 1751350800,
      "amount": "19.00",
      "currency_code": "USD",
      "order_name": "#1007",
      "financial_status": "PAID",
      "refund_in_progress": false,
      "dispute": {
        "type": "CHARGEBACK",
        "status": "UNDER_REVIEW",
        "initiated_at_timestamp": 1751955600,
        "last_updated_timestamp": 1752214800
      }
    }
  ]
}
	
**2.) REFUND**: make a POST request to:

		use the following base URL:
			[**deprecated**]:
	    {shopify_store}/apps/subscribfy-api/dashboard.php?cid={{ cid }}&hash={{ hash }}&exm=1
	    
	    *****new version:* 
	    **{shopify_store}/apps/subscribfy-api/v1/membership/manage?cid={{ cid }}&hash={{ hash }}&exm=1**
    
            POST:
                action: updateRefundContent
                scid: {{ scid }}
                order_gid → (optional)

    vars accessible from .liquid:
    cid = {{customer.id}}  --> shopify logged in customer id
    hash = {{customer.metafields.exison.exison_hash}}  --> subscribfy customer unique token
    scid = {{customer.metafields.exison.customer_subscription1.scid}}  --> subscribfy subscription contract id
		order_gid (optional) → Shopify order GID (integer)
												If provided: that specific order will be processed for refund
												If omitted: the latest re-charge order under the subscription will be processed

		exemple:
		*curl -X POST "{URL}" \\
		-d 'scid=1234' \\
		-d 'action=updateRefundContent'  
		-d '*order_gid*=123'*

    returns JSON:
	    result: 1  --> task completed successfully
	    result: -1  --> refund in progress or already refunded
	    result: ""  --> validation error, invalid customer or contract not found
	    result: 9 --> too many requests
**3.) Get Smart Offers**: make a POST request to:
	    **{shopify_store}/apps/subscribfy-api/v1/membership/churn/offers**
    
            POST:
                cancellation_reason: {{ cancellation_reason }}

    vars accessible from .liquid:
    cid = {{customer.id}}  --> shopify logged in customer id
    hash = {{customer.metafields.exison.exison_hash}}  --> subscribfy customer unique token
    scid = {{customer.metafields.exison.customer_subscription1.scid}}  --> subscribfy subscription contract id
		cancellation_reason = One of --> 1. technical_issues -- "I'm having technical problems."
																		2. enough_items - "I have enough items."
																		3. too_expensive - "It's too expensive."
																		4. not_need_subscription - "I don't need a subscription."
																		5. not_using_enough - "I don't use it enough."
																		6. not_found_products - "I couldn't find the products I liked."
																		7. order_issues - "Problems with my order."
																		8. use_another_service - "I'm using another service."
																		9. other - "Other"

		exemple:
		*curl -X POST "{URL}" \\
		-d 'scid=1234' \\
		-d 'cancellation_reason=too_expensive'*

- Success Response:
  {
    "status": "success",
    "message": "Successfully retrieved smart offers",
    "data": {
        "id": 2,
        "shop_id": 71,
        "subscription_type": 3,
        "reason_type": "technical_issues",
        "reason_value": "I'm having technical problems.",
        "offers": [
            {
                "id": "offer_1758270074078_3683",
                "is_open": false,
                "name": "Change Subscription Price",
                "description": "Change the price of the subscription",
                "discount_type": "percentage",
                "discount_value": 30,
                "type": "change_price"
            },
            {
                "id": "offer_1758270079382_6637",
                "is_open": false,
                "name": "Change Subscription Frequency",
                "description": "Change how often the subscription is billed",
                "interval_count": 2,
                "interval_name": "day",
                "type": "change_frequency"
            },
            {
                "id": "offer_1758270088229_213",
                "is_open": false,
                "name": "Reward with Store Credits",
                "description": "Reward the customer with store credits",
                "store_credits": 100,
                "type": "reward_store_credits"
            }
        ],
        "created_at": "2025-09-19T08:21:58.000000Z",
        "updated_at": "2025-10-02T23:53:10.000000Z"
    }
}
- No Offers Available:
  {
	  "status": "success",
	  "message": "No smart offers available",
	  "data": null
	}

- Error Response: - "Bad request"
  {
    "error": true,
    "message": "Bad request"
  }
   
**4.) UpdateSubscriptionByChurn**: make a POST request to:
	    **{shopify_store}/apps/subscribfy-api/v1/membership/churn/offers/{id}/activation**
    
            POST:
                scid: {{ scid }}
                cancellation_reason: {{ cancellation_reason }}
                
offer_1758270074078_3683
    vars accessible from .liquid:
    cid = {{customer.id}}  --> shopify logged in customer id
    hash = {{customer.metafields.exison.exison_hash}}  --> subscribfy customer unique token
    scid = {{customer.metafields.exison.customer_subscription1.scid}}  --> subscribfy subscription contract id
		cancellation_reason = One of --> 1. technical_issues -- "I'm having technical problems."
																		2. enough_items - "I have enough items."
																		3. too_expensive - "It's too expensive."
																		4. not_need_subscription - "I don't need a subscription."
																		5. not_using_enough - "I don't use it enough."
																		6. not_found_products - "I couldn't find the products I liked."
																		7. order_issues - "Problems with my order."
																		8. use_another_service - "I'm using another service."
																		9. other - "Other"
		id = Applied smart offer id => {{ offer_1758270074078_3683 }}

		exemple:
		*curl -X POST "{URL}" \\
		-d 'scid=1234' \\
		-d 'cancellation_reason=too_expensive'*

- Error response: "Invalid offer data.", "Invalid offer type", etc.
 {
	 "result": "error",
	 "message": "Invalid offer data"
 }
- Success response:
  {
	  "result": "success
  }