Powered by Coinflow
Payments · Documentation
Operational

Get Available Plans

GET https://api-sandbox.coinflow.cash/api/subscription/{merchantId}/plans

Get the available subscription plans for a merchant

Reference: /api-reference/api-reference/subscription/get-available-plans

Authentication

  • x-coinflow-auth-session-key header (required) — The session key generated for the end user - see /api-reference/api-reference/authentication/get-session-key
  • x-coinflow-auth-wallet header (required) — The web3 wallet of the end user - see /api-reference/api-reference/authentication/get-session-key
  • x-coinflow-auth-blockchain header (required) — The blockchain associated with the end user - see /api-reference/api-reference/authentication/get-session-key

Request

Path parameters

  • merchantId (string, required)

Response

200

Ok

  • list of object
    • id (string, required)
    • name (string, required)
    • code (string, required)
    • interval (enum, required)
      • Allowed values: Daily, Weekly, Monthly, Yearly
    • amount (object, required)
      • cents (integer, required)
      • currency (enum, required)
        • Allowed values: USD, AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CHF, CLF, CLP, CNY, COP, CRC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ETB, EUR, FJD, GBP, GEL, GHS, GMD, GNF, GTQ, GYD, HKD, HNL, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MWK, MVR, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RWF, SAR, SCR, SDG, SEK, SGD, SLE, SLL, SOS, SRD, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, UYU, UZS, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL, CDF, ERN, FKP, KPW, RUB, SBD, SHP, SSP, VES
    • active (boolean, required)
    • duration (integer, optional)
    • description (string, optional)
    • transaction (string, optional)
    • settlementChain (enum or enum or enum or enum or enum or enum or enum or enum, optional)
    • merchantInitiated (boolean, optional) — Only specify this as true if you do not want subscription payments automatically processed. Then you will be responsible for manually calling the merchant initiated transaction endpoint.

Examples

Request

{}

Response

[
  {
    "id": "plan_8f3b2c1d9a4e4f7b",
    "name": "Premium Monthly Plan",
    "code": "PREM_MONTHLY_001",
    "interval": "Monthly",
    "amount": {
      "cents": 2999,
      "currency": "USD"
    },
    "active": true,
    "duration": 12,
    "description": "Access to all premium features billed monthly for one year.",
    "transaction": "txn_5a7c9e2f3b1d4a6e",
    "settlementChain": "eth",
    "merchantInitiated": false
  }
]

SDK Code

import requests

url = "https://api-sandbox.coinflow.cash/api/subscription/merchantId/plans"

payload = {}
headers = {
    "x-coinflow-auth-session-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.get(url, json=payload, headers=headers)

print(response.json())
const url = 'https://api-sandbox.coinflow.cash/api/subscription/merchantId/plans';
const options = {
  method: 'GET',
  headers: {'x-coinflow-auth-session-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-sandbox.coinflow.cash/api/subscription/merchantId/plans"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("GET", url, payload)

	req.Header.Add("x-coinflow-auth-session-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.coinflow.cash/api/subscription/merchantId/plans")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-coinflow-auth-session-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api-sandbox.coinflow.cash/api/subscription/merchantId/plans")
  .header("x-coinflow-auth-session-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api-sandbox.coinflow.cash/api/subscription/merchantId/plans', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-coinflow-auth-session-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
using RestSharp;

var client = new RestClient("https://api-sandbox.coinflow.cash/api/subscription/merchantId/plans");
var request = new RestRequest(Method.GET);
request.AddHeader("x-coinflow-auth-session-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
import Foundation

let headers = [
  "x-coinflow-auth-session-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.coinflow.cash/api/subscription/merchantId/plans")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()