Subscriptions

The Subscriptions API allows you to manage your clients subscriptions within your Rebill account. You can retrieve and update subscriptions, export them in CSV data, process them and schedule their next charge date. Also, you can retrieve the customer cards associated to a subscription and trigger a request via email for card update.


GET/v2/subscriptions

Get subscriptions

Get a list of all the subscriptions from your organization.

Optional Query Parameters

    orderstring
    searchstring
    pagestring
    takestring
    statusstring

Loading...

Response

      {
        "data": [
            {
                "id": "example-id-c837e60b-681c",
                "price": {
                    "id": "example-price-id-1ccbcc54",
                    "gateway": {
                        "id": "example-gateway-id-1b73dcb5",
                        "type": "rebill_gateway",
                        "country": "CL",
                        "description": "Rebill Gateway | Crossborder | Chile | ALL",
                        "publicKey": "examplePublicKey8lynHfD3elg",
                        "recurring": false,
                        "crossborder": true
                    },
                    "frequency": {
                        "type": "months",
                        "quantity": 1
                    },
                    "repetitions": 12,
                    "description": "Monthly subscription for services",
                    "currency": "CLP",
                    "archive": false,
                    "itemId": "example-item-id-1620beac",
                    "amount": "15000",
                    "type": "recurring",
                    "debitDay": 5,
                    "debitType": "Direct"
                },
                "quantity": 1,
                "lastChargeDate": "2024-02-05T16:00:08.000Z",
                "nextChargeDate": "2024-03-05T15:59:59.000Z",
                "remainingIterations": 11,
                "userEmail": "customer@example.com",
                "customerFirstName": "Customer",
                "customerLastName": "Example",
                "status": "ACTIVE",
                "createdAt": "2024-01-05T15:59:58.749Z",
                "title": "Basic Subscription Plan",
                "card": "example-card-id-d25c2f56",
                "balance": "0",
                "invoices": [
                    "example-invoice-id-567ae438",
                    "example-invoice-id-17320e7f"
                ],
                "externalReference": "12345",
                "metadataObject": {}
            }
            // more subscriptions
        ]
    }


GET/v2/subscriptions/{type}/all

Get subscriptions by type

Obtain information on all subscriptions associated with a specific price type (cyclical or recurring subscriptions).

Required Path Parameters

    typestringrequired

Optional Query Parameters

    orderstring
    searchstring
    pagestring
    takestring
    statusstring

Loading...

Response

      {
      "data": [
        []
      ],
      "meta": {
        "page": 3,
        "take": 10,
        "itemCount": 150,
        "pageCount": 150,
        "hasPreviousPage": true,
        "hasNextPage": true
      },
      "results": [
        {
          "id": "b2fefb2b-1203-4322-a411-b835f29e9f26",
          "price": {
            "id": "1cfb35d1-be84-4a93-be34-e9787e408602",
            "gateway": 45179,
            "frequency": {
              "quantity": 1,
              "type": "months"
            },
            "repetitions": 0,
            "description": "string",
            "currency": "string",
            "priceSetting": {
              "id": "b2fefb2b-1203-4322-a411-b835f29e9f26",
              "documentRequired": true,
              "phoneRequired": true,
              "showImage": true,
              "billingAddressRequired": true,
              "redirectUrl": "http://www.example.com",
              "paymentMethods": [
                "CARD"
              ],
              "expirationDate": "2024-02-28T16:11:00.165Z",
              "allowDiscountCodes": true
            },
            "amount": "string",
            "tiers": [
              "string"
            ],
            "type": "string",
            "parent": "string",
            "archive": false,
            "debitDay": 0,
            "debitType": "string",
            "createdAt": "2024-02-28T16:11:00.165Z",
            "itemId": "a1g9u9s3-t1i6n-1v2i1l-l0a034ra52n",
            "isExpired": true
          },
          "quantity": 2,
          "lastChargeDate": "2022-10-05T16:20:36.896Z",
          "nextChargeDate": "2023-11-05T16:20:36.896Z",
          "createdAt": "2022-10-05T16:20:36.896Z",
          "remainingIterations": 2,
          "userEmail": "john.doe@rebill.com",
          "customerFirstName": "John",
          "customerLastName": "Doe",
          "status": "ACTIVE",
          "title": "Rebill Plan",
          "card": "f77c1337-119f-4ea2-879a-4bbb39a71da3",
          "nextRetryingDate": "2023-12-16T12:02:02.333Z",
          "lastRetryingDate": "2022-10-05T16:20:36.896Z",
          "balance": "1000",
          "externalReference": "f1375266-ed99-4e50-bb02-ef98dc1f79bd",
          "metadataObject": {
            "SKU": "d0fc52e1-9537-419d-ac2b-c36303512aab"
          },
          "coupon": {
            "name": "Spring offer",
            "description": "Spring offer discount to our customers in the first month.",
            "redeemUpTo": "2025-12-16T16:12:12.993Z",
            "maxRedemptions": 256,
            "durationType": "forever",
            "durationInCycles": "forever",
            "discountType": "fixed",
            "redemptionPerUserType": "once_per_user",
            "discountedPercentage": "50",
            "discountedAmount": "10",
            "discountCurrency": "USD",
            "appliesTo": [
              "479b2c49-9a08-4f24-936c-a550ed6d3238",
              "8d7ae35c-b6b8-469a-9b86-6b6481de28b1",
              "38aff698-79df-4e5f-80b5-5bb1d501ae32"
            ],
            "currenciesDiscountOptions": {
              "ARS": "35000",
              "UYU": "3800"
            },
            "metadata": {
              "SKU": 16121993,
              "vertical": "programming e-learning"
            },
            "archive": false,
            "createdAt": "2024-02-28T16:10:59.623Z",
            "isPaused": false,
            "id": "1a6g1u21-99st-9312-00i-n6vi0l352l1a",
            "totalRedemptions": 777,
            "status": "Active",
            "couponCodes": [
              "string"
            ]
          }
        }
      ]
  }


GET/v2/subscriptions/{id}

Get subscription by ID

Retrieve detailed information about a specific subscription using its unique ID.

Required Path Parameters

    idstringrequired

Optional Query Parameters

    withDeletedboolean

Loading...

Response

  {
                "id": "example-id-c837e60b-681c",
                "price": {
                    "id": "example-price-id-1ccbcc54",
                    "gateway": {
                        "id": "example-gateway-id-1b73dcb5",
                        "type": "rebill_gateway",
                        "country": "CL",
                        "description": "Rebill Gateway | Crossborder | Chile | ALL",
                        "publicKey": "examplePublicKey8lynHfD3elg",
                        "recurring": false,
                        "crossborder": true
                    },
                    "frequency": {
                        "type": "months",
                        "quantity": 1
                    },
                    "repetitions": 12,
                    "description": "Monthly subscription for services",
                    "currency": "CLP",
                    "archive": false,
                    "itemId": "example-item-id-1620beac",
                    "amount": "15000",
                    "type": "recurring",
                    "debitDay": 5,
                    "debitType": "Direct"
                },
                "quantity": 1,
                "lastChargeDate": "2024-02-05T16:00:08.000Z",
                "nextChargeDate": "2024-03-05T15:59:59.000Z",
                "remainingIterations": 11,
                "userEmail": "customer@example.com",
                "customerFirstName": "Customer",
                "customerLastName": "Example",
                "status": "ACTIVE",
                "createdAt": "2024-01-05T15:59:58.749Z",
                "title": "Basic Subscription Plan",
                "card": "example-card-id-d25c2f56",
                "balance": "0",
                "invoices": [
                    "example-invoice-id-567ae438",
                    "example-invoice-id-17320e7f"
                ],
                "externalReference": "12345",
                "metadataObject": {}
            }

GET/v2/subscriptions/customer/{email}

Get subscription by customer

Obtain all subscriptions of a customer by customer email.

Required Path Parameters

    emailstringrequired

Loading...

Response

  {
    "id": "xxxxxxx-1203-4322-a411-b835f29e9f26",
    "price": {
      "id": "xxxxxxx-be84-4a93-be34-e9787e408602",
      "gateway": 45179,
      "frequency": {
        "quantity": 1,
        "type": "months"
      },
      "repetitions": 0,
      "description": "string",
      "currency": "string",
      "priceSetting": {
        "id": "xxxxxx-1203-4322-a411-b835f29e9f26",
        "documentRequired": true,
        "phoneRequired": true,
        "showImage": true,
        "billingAddressRequired": true,
        "redirectUrl": "http://www.example.com",
        "paymentMethods": [
          "CARD",
        ],
        "expirationDate": "2024-02-28T16:11:00.165Z",
        "allowDiscountCodes": true
      },
      "amount": "string",
      "tiers": [
        "string"
      ],
      "type": "string",
      "parent": "string",
      "archive": false,
      "debitDay": 0,
      "debitType": "string",
      "createdAt": "2024-02-28T16:11:00.165Z",
      "itemId": "a1g9u9s3-t1i6n-1v2i1l-l0a034ra52n",
      "isExpired": true
    },
    "quantity": 2,
    "lastChargeDate": "2022-10-05T16:20:36.896Z",
    "nextChargeDate": "2023-11-05T16:20:36.896Z",
    "createdAt": "2022-10-05T16:20:36.896Z",
    "remainingIterations": 2,
    "userEmail": "john.doe@rebill.com",
    "customerFirstName": "John",
    "customerLastName": "Doe",
    "status": "ACTIVE",
    "title": "Rebill Plan",
    "card": "f77c1337-119f-4ea2-879a-4bbb39a71da3",
    "nextRetryingDate": "2023-12-16T12:02:02.333Z",
    "lastRetryingDate": "2022-10-05T16:20:36.896Z",
    "balance": "1000",
    "externalReference": "f1375266-ed99-4e50-bb02-ef98dc1f79bd",
    "metadataObject": {
      "SKU": "d0fc52e1-9537-419d-ac2b-c36303512aab"
    },
    "coupon": {
      "name": "Spring offer",
      "description": "Spring offer discount to our customers in the first month.",
      "redeemUpTo": "2025-12-16T16:12:12.993Z",
      "maxRedemptions": 256,
      "durationType": "forever",
      "durationInCycles": "forever",
      "discountType": "fixed",
      "redemptionPerUserType": "once_per_user",
      "discountedPercentage": "50",
      "discountedAmount": "10",
      "discountCurrency": "string",
      "appliesTo": [
        "479b2c49-9a08-4f24-936c-a550ed6d3238",
        "8d7ae35c-b6b8-469a-9b86-6b6481de28b1",
        "38aff698-79df-4e5f-80b5-5bb1d501ae32"
      ],
      "currenciesDiscountOptions": {
        "ARS": "35000",
        "UYU": "3800"
      },
      "metadata": {
        "SKU": 16121993,
        "vertical": "programming e-learning"
      },
      "archive": false,
      "createdAt": "2024-02-28T16:10:59.623Z",
      "isPaused": false,
      "id": "1a6g1u21-99st-9312-00i-n6vi0l352l1a",
      "totalRedemptions": 777,
      "status": "Active",
      "couponCodes": [
        "string"
      ]
    }
  }

GET/v2/subscriptions/{id}/payments

Get subscription payments

Retrieve a list with all the recurring payments for a specific subscription.

Required Path Parameters

    idstringrequired

Loading...

Response

  [
    {
      "id": "xxxxxxx-1203-4322-a411-b835f29e9f26"
    }
  ]

GET/v2/subscriptions/{id}/customer_cards

Get customer cards

Get all cards associated with a specific customer by its ID.

Required Path Parameters

    idstringrequired

Loading...

Response

  [
    {
        "id": "d25c2f56-b3f0-4ea5-a01e-9623656f44a9",
        "bin": 370000,
        "last4": "2032",
        "cardHolder": "APRO",
        "cardNumber": "370000bx_dfb27a617a984280a3a9769857dbdc14_bx2032",
        "expiration": {
            "month": 12,
            "year": "2028"
        }
    },
    {
        "id": "287c8f41-bb54-46d7-be51-f16b8c48b36a",
        "bin": 529991,
        "last4": "0015",
        "cardHolder": "FRANCO REBILL",
        "cardNumber": "529991bx_e21f828c4fcc4b1387a3265706737b92_bx0015",
        "expiration": {
            "month": 8,
            "year": "2030"
        }
    },
    {
        "id": "0fdff414-d6e6-4bd2-b1a8-f4f32f304fad",
        "bin": 529991,
        "last4": "0015",
        "cardHolder": "APRO",
        "cardNumber": "529991bx_0f0800a96ecc4f1989f7f588ebce48a7_bx0015",
        "expiration": {
            "month": 12,
            "year": "2028"
        }
    }
]

POST/v2/subscriptions/{id}/pay

Process a subscription and schedule its next charge

Take control of subscription payments by executing a payment and schedule the next debit date.

Required Path Parameters

    idstringrequired

Required Body Parameters

    datedatetimerequired

Loading...

Response

  {
    "receipt": {
        "id": "xxxxxxx-d0b8-4c2b-xxx-xx",
        "cartId": "xxxxxxxx-504e-430b-xxxxxxx-xx",
        "organizationId": "xxxxxxx-ff7e-45c7-ac1b-xxxxxxxxxx",
        "paidBags": [
            {
                "payment": {
                    "amount": "12500",
                    "id": "xxxxx-14ab-4325-83e5-xx",
                    "currency": "CLP",
                    "status": "SUCCEEDED",
                    "gateway": {
                        "id": "xxxxx-630a-4438-b7d9-xx",
                        "type": "rebill_gateway",
                        "country": "I",
                        "description": "Rebill Gateway | Crossborder | Chile | ALL",
                        "status": "ACCEPTED",
                        "publicKey": "xxxxxxxxxxxxxx",
                        "recurring": false,
                        "crossborder": true
                    },
                    "createdAt": "2024-02-29T18:58:36.609Z",
                    "source": "PROCESS_SINGLE"
                },
                "prices": [
                    {
                        "id": "xxxxxxxx-bb97-4b6c-8406-xxx",
                        "quantity": 1
                    }
                ],
                "schedules": [
                    "xxxxxxx-681c-4848-af43-xx"
                ]
            }
        ],
        "buyer": {
            "customer": {
                "id": "xxxxxxx-b011-4e8d-9213-90c038b61db5",
                "firstName": "John",
                "lastName": "Doe",
                "cellPhone": "54-11111111",
                "birthday": null,
                "taxIdType": "",
                "taxIdNumber": "",
                "personalIdType": "DNI",
                "personalIdNumber": "xxxxxxxxx",
                "userEmail": "example@email.com",
                "address": {
                    "street": "String",
                    "city": "String",
                    "state": "String",
                    "country": "AR",
                    "zipCode": "1419",
                    "number": "1314",
                    "floor": "5",
                    "apt": "B",
                    "description": null
                }
            },
            "card": {
                "id": "xxxxxxxxx-b3f0-4ea5-a01e-9623656f44a9",
                "bin": 370000,
                "last4": "2032",
                "cardHolder": "APRO",
                "cardNumber": "xxxxxxxxx",
                "expiration": {
                    "month": 12,
                    "year": "2028"
                }
            }
        },
        "type": "invoice",
        "createdAt": "2024-02-29T18:58:36.613Z"
    },
    "date": "2024-03-04T18:58:24.433Z",
    "status": "ACTIVE",
    "remainingIterations": null
}

POST/v2/subscriptions/{id}/change-card

Request card update via email

This endpoint sends an email to a customer, requesting them to update the card associated with their subscription. This is a highly effective method for reducing churn rate.

Required Path Parameters

    idstringrequired

Loading...

Response

  {

  }

POST/v2/subscriptions/{email}/export/csv

Export subscriptions to CSV

Export your organization's subscriptions in CSV format.

Required Path Parameters

    idstringrequired

Required Body Parameters

    clientTimeZonestringrequired
    fromDatestringrequired
    toDatestringrequired

Loading...

Response

  {

  }

PUT/v2/subscriptions/{id}

Update subscription

Update a subscription's data.

Required Path Parameters

    idstringrequired

Optional Query Parameters

    amountstring
    quantitynumber
    cardstring
    nextChargeDatedatetime
    statusenum
    metadataobject
    newPriceTemplateIdstring
    titlestring
    descriptionstring
    couponIdstring

Loading...

Response

  {
                "id": "example-id-c837e60b-681c",
                "price": {
                    "id": "example-price-id-1ccbcc54",
                    "gateway": {
                        "id": "example-gateway-id-1b73dcb5",
                        "type": "rebill_gateway",
                        "country": "CL",
                        "description": "Rebill Gateway | Crossborder | Chile | ALL",
                        "publicKey": "examplePublicKey8lynHfD3elg",
                        "recurring": false,
                        "crossborder": true
                    },
                    "frequency": {
                        "type": "months",
                        "quantity": 1
                    },
                    "repetitions": 12,
                    "description": "Monthly subscription for services",
                    "currency": "CLP",
                    "archive": false,
                    "itemId": "example-item-id-1620beac",
                    "amount": "15500",
                    "type": "recurring",
                    "debitDay": 5,
                    "debitType": "Direct"
                },
                "quantity": 1,
                "lastChargeDate": "2024-02-05T16:00:08.000Z",
                "nextChargeDate": "2024-03-05T15:59:59.000Z",
                "remainingIterations": 11,
                "userEmail": "customer@example.com",
                "customerFirstName": "Customer",
                "customerLastName": "Example",
                "status": "ACTIVE",
                "createdAt": "2024-01-05T15:59:58.749Z",
                "title": "Basic Subscription Plan",
                "card": "example-card-id-d25c2f56",
                "balance": "0",
                "invoices": [
                    "example-invoice-id-567ae438",
                    "example-invoice-id-17320e7f"
                ],
                "externalReference": "12345",
                "metadataObject": {}
            }

Was this page helpful?