Developers

Developers

  • Docs
  • Help
  • Blog

›/api

Overview

  • Getting Started
  • Testing

Integrations

  • Simple link
  • Simple embed
  • React SDK
  • Embed SDK
  • Webhooks
  • REST Hooks
  • Wix Embed SDK

API

  • Authentication

/api

    /v1/current_company

    • GET /
    • PUT /
    • GET /stats

    /v1/customers

    • GET /
    • GET /:id

    /v1/payments

    • GET /
    • GET /:id

    /v1/plans

    • GET /
    • POST /
    • PUT /:id

    /v1/refunds

    • POST /

    /v1/subscriptions

    • GET /
    • GET /:id
    • DELETE /:id

    /v1/user

    • GET /

GET /api/v1/subscriptions/:id

Fetch a subscription by ID, this will also pull down the customer and payments.

Request

Curl
Ruby
$ curl -X GET https://api.payhere.co/api/v1/subscriptions/:id \
       -H "Accept: application/json" \
       -H "Authorization: Bearer ${api_key_here}"
require "http"
require "json"

resp = HTTP.auth("Bearer #{api_key_here}")
           .get("https://api.payhere.co/api/v1/subscriptions/:id")

parsed = JSON.parse(resp.body)

Params

  • id - Subscription ID to lookup

Response

{
  "data": {
    "id": 173524457,
    "customer_id": 989899294,
    "last_charged": "2018-01-03T00:00:00.000Z",
    "next_charge_at": "2018-02-03T00:00:00.000Z",
    "status": "active",
    "stripe_subscription_id": "d44ea881",
    "stripe_plan_id": "void_pro_sub_1",
    "billing_interval": "month",
    "membership_plan_id": 372786875,
    "provider": "stripe",
    "metadata": {},
    "billing_interval_count": 1,
    "min_billing_cycles": null,
    "created_at": "2018-01-03T00:00:00.000Z",
    "updated_at": "2018-01-03T00:00:00.000Z",
    "type": "subscriptions",
    "customer": {
      "id": 989899294,
      "name": "Geoff Williams",
      "email": "g.williams01@example.org",
      "ip_address": null,
      "location": {},
      "created_at": "2019-03-04T17:08:19.453Z",
      "updated_at": "2019-03-04T17:08:19.453Z",
      "type": "customers"
    },
    "plan": {
      "id": 20,
      "payment_type": "recurring",
      "name": "Pro Plan",
      "description": "",
      "price": 15,
      "price_in_cents": 1500,
      "currency": "gbp",
      "slug": "pro-plan",
      "billing_interval": "month",
      "billing_interval_count": 1,
      "hidden": false,
      "min_billing_cycles": null,
      "billing_day": null,
      "limited_qty": false,
      "qty": 0,
      "cancel_after": null,
      "success_url": "",
      "trial_period_days": null,
      "created_at": "2019-04-19T09:02:45.846Z",
      "updated_at": "2019-04-27T12:05:38.223Z",
      "type": "plans"
    },
    "payments": [
      {
        "id": 2680839,
        "hashid": "7ESVZLr",
        "reference": "SUB816",
        "amount": 24.99,
        "company_id": 636211471,
        "card_brand": "visa",
        "card_last4": null,
        "secure_token": "-zLiIKE-7MEqgeWJgDJpww",
        "status": "success",
        "created_at": "2018-01-03T00:00:00.000Z",
        "updated_at": "2018-01-03T00:00:00.000Z",
        "type": "payments"
      }
    ]
  }
}

Errors

  • 404 Not found
  • 401 Unauthorized
← GET /DELETE /:id →
  • Request
    • Params
  • Response
  • Errors
Developers
Docs
Getting StartedEmbed SDKAPI Reference
Payhere
HelpSignup freeFeatures
More
Our BlogGitHubTwitter
Copyright © 2025 Payhere Payments Ltd