Subscriber Rebill API

Pause, resume, or update rebill settings for an existing subscriber.

Use the Subscriber Rebill API to pause a subscriber's rebills, resume them, or change the rebill amount and schedule. Each change is sent as a single request.

This endpoint uses a different host and different field names from the XML Gateway, described in the Gateway Integration Guide. Its host is api-gateway.segpay.com, not gateway.segpay.com. Its field names are lowercase with underscores, for example rebill_amount. The XML Gateway uses names such as RebillAmount, and the two sets of names aren't interchangeable.

Prerequisites

All of the following must be true before you can use this endpoint.

  • The feature is enabled for your user ID. Enablement is per user ID, not per account. To request it, email gatewaysupport@segpay.com.

  • You have an API token. Segpay issues your token. See Authentication.

  • The subscription uses a Dynamic Rebill product (product type A). With a Dynamic Rebill product, your signup request sends the initial amount, initial days, rebill amount, and rebill days for each subscriber, so one product code covers any terms. Requests for subscribers on any other product type are rejected. See Check a product's type.

  • The subscriber's status is Active. Requests against cancelled or expired subscribers are rejected. A chargeback or alert cancels a subscription automatically, so updates to that subscriber are rejected too. A paused subscriber is still Active and can be resumed.

  • The subscriber is on an account you can access. Requests against subscribers on other accounts are rejected.

  • You have the subscriber's subscriberID. This is returned in the signup response and in postbacks.

A subscriberID is issued for declined signups as well as approved ones. Having one doesn't mean the subscriber has an active subscription.

Check a product's type

  1. Log in to the Gateway admin at admin.segpay.com.

  2. Go to Administration > Products. Your products are listed by product code.

  3. Find your product code. In the Type/Description column, the letter beside it is the product type. A Dynamic Rebill product shows A. The text beside the letter is the product's description, not its type.

    Products list in the Gateway admin, where the Type/Description column shows type A beside the description Membership

Testing

The test card number in your site's settings doesn't work for rebill testing. To set up testing, email gatewaysupport@segpay.com.

  • Support sets you up on a Demo MID with a Dynamic Rebill product and walks you through it.

  • If you're already processing live transactions, support makes sure testing doesn't disrupt them, and helps you move off the Demo MID when you're ready to go live.

Authentication

This endpoint uses bearer token authentication. Include your token in the Authorization header on every request.

Request headers
Authorization: Bearer YOUR_API_TOKEN
Content-Type: application/json
  • Segpay issues your token. Tokens don't expire.

  • To request a new token, email gatewaysupport@segpay.com.

  • Keep your token on your server. Don't include it in client-side code, in a URL, or anywhere a customer could read it.

When a new token is issued, your current token stops working immediately. Any integration still using it fails until you switch it to the new token. Plan the change so both happen together.

Endpoint

PATCH https://api-gateway.segpay.com/subscribers/{subscriberID}/subscriptions/0

The 0 at the end of the path is fixed. A subscriber holds a single subscription, and any other value is rejected.

Path parameters

Parameter Description

subscriberID

The ID assigned to the subscriber at signup. It's returned in the signup response and in postbacks.

Pause and resume rebills

  • Pausing: Rebills stop. The subscription stays Active, and its amount and schedule are kept. You can also send a new amount and schedule in the same request; they take effect when the subscription resumes.

  • Resuming: The subscription rebills on its current rebill date. If that date has already passed, the rebill is processed right away. Later rebills follow the schedule. To resume without an immediate rebill, send a future rebill_date in the same request. See Resume with a new rebill date example.

  • Flex terms: If the subscription has flex terms, resuming it sends them back to the first position. Changing the amount or schedule does the same. See Flex terms.

  • Cancelling: Cancelling is separate from pausing, and a subscription can be cancelled whether or not it is paused. A cancelled subscriber is no longer Active, and this API rejects any update to it.

If the rebill date has already passed, the rebill is processed right away. This can happen when you resume a subscription or change its schedule.

Rebill dates are in UTC, and rebill_date sent without a time is treated as the start of that day (00:00:00 UTC). So if you send today's date without a time, the rebill is processed right away. To avoid this, send a date and time at least 1 hour in the future.

Example: Pause rebills

To pause rebills, set rebill_status to Paused:

cURL
curl -X PATCH "https://api-gateway.segpay.com/subscribers/123456789/subscriptions/0" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "rebill_status": "Paused"
  }'

Example: Resume rebills

To resume rebills, set rebill_status to Active. The subscription rebills on its current rebill date. If that date has already passed, the rebill is processed right away:

cURL
curl -X PATCH "https://api-gateway.segpay.com/subscribers/123456789/subscriptions/0" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "rebill_status": "Active"
  }'

Example: Resume with a new rebill date

To resume without an immediate rebill, set rebill_status to Active and send a future rebill_date. The four schedule parameters are always sent together, so include the subscription's current rebill_amount, period_type, and date_value as well:

cURL
curl -X PATCH "https://api-gateway.segpay.com/subscribers/123456789/subscriptions/0" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "rebill_status": "Active",
    "rebill_amount": 19.99,
    "rebill_date": "2028-01-15",
    "period_type": "INTERVAL",
    "date_value": 30
  }'

Example: Pause and change the schedule

Use this when a subscription should come back on different terms, for example when a customer pauses their membership and will return at a new price. The subscription is paused, and the new amount and schedule take effect when it resumes.

If you resume before the new rebill date, the next rebill runs on that date. If you resume after it, the rebill is processed right away.

cURL
curl -X PATCH "https://api-gateway.segpay.com/subscribers/123456789/subscriptions/0" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "rebill_status": "Paused",
    "rebill_amount": 19.99,
    "rebill_date": "2028-01-15",
    "period_type": "SAME_DAY_MONTH",
    "date_value": 15
  }'

Change the rebill amount or schedule

You can change a subscriber's rebill amount, their rebill schedule, or both. Always send these four parameters together, even if you're changing only one:

  • rebill_amount: the amount charged on each rebill.

  • rebill_date: when the next rebill runs.

  • period_type: how often rebills occur.

  • date_value: the number of days between rebills, or the date of the month.

For accepted values, see Schedule parameters.

Before you send a change, check:

  • The values you aren't changing: Send the subscription's current values. These are the values from the subscriber's signup request, or from your most recent update. Whatever you send replaces the current value.

  • The rebill date: If the subscription isn't paused and the rebill_date you send has already passed, the rebill is processed right away. See Pause and resume rebills.

  • Flex terms: If the subscription has flex terms, the change restarts them from the first position. See Flex terms.

Example: Change only the amount

This example changes the amount to 19.99 and keeps everything else the same. The subscription's next rebill is January 15, 2028, and it rebills every 30 days, so those values are sent unchanged:

cURL
curl -X PATCH "https://api-gateway.segpay.com/subscribers/123456789/subscriptions/0" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "rebill_amount": 19.99,
    "rebill_date": "2028-01-15",
    "period_type": "INTERVAL",
    "date_value": 30
  }'

Example: Change only the schedule

This example changes the schedule to the 15th of each month and keeps everything else the same. The subscription's next rebill is January 15, 2028, and its amount is 19.99, so those values are sent unchanged:

cURL

curl -X PATCH "https://api-gateway.segpay.com/subscribers/123456789/subscriptions/0" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "rebill_amount": 19.99,
    "rebill_date": "2028-01-15",
    "period_type": "SAME_DAY_MONTH",
    "date_value": 15
  }'

Flex terms

  • Apply or change flex terms: Set flex_enabled to true and send the flex_terms_id. You can send these without the schedule parameters.

  • Keep the current flex terms: Leave out flex_enabled and flex_terms_id.

  • Remove flex terms: Set flex_enabled to false.

  • Get your flex terms IDs: Email gatewaysupport@segpay.com.

When you apply or change flex terms, the rebill amount must meet the new terms, or the request is rejected:

  • It can't be less than the minimum amount of the flex terms.

  • With Terms Flex, it must equal the amount at the first position.

The amount checked is the rebill_amount in your request. If you don't send one, it's the subscription's current rebill amount.

Resuming a subscription, or changing its amount or schedule, restarts its flex terms from the first position.

Example: Apply or change flex terms

This example applies the flex terms with ID 97. Replace 97 with your flex terms ID:

cURL

curl -X PATCH "https://api-gateway.segpay.com/subscribers/123456789/subscriptions/0" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "flex_enabled": true,
    "flex_terms_id": 97
  }'

Example: Apply flex terms and change the amount

This example applies flex terms and changes the amount to 19.99 in one request. Because rebill_amount is a schedule parameter, all four schedule parameters are sent. The date and schedule are sent unchanged:

cURL

curl -X PATCH "https://api-gateway.segpay.com/subscribers/123456789/subscriptions/0" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "rebill_amount": 19.99,
    "rebill_date": "2028-01-15",
    "period_type": "INTERVAL",
    "date_value": 30,
    "flex_enabled": true,
    "flex_terms_id": 97
  }'

Example: Remove flex terms

This example removes flex terms from the subscription:

cURL

curl -X PATCH "https://api-gateway.segpay.com/subscribers/123456789/subscriptions/0" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "flex_enabled": false
  }'

Body parameters

Send parameters as JSON in the request body.

Schedule parameters

These four parameters are sent as a set. If a request includes any one of them, it must include all four, or it's rejected. See Change the rebill amount or schedule.

Parameter Type Accepted values Description

rebill_amount

Numeric Depends on the currency. For example, up to 2 decimal places for USD, GBP, and EUR, and none for JPY. The amount charged on each rebill, in the subscriber's existing currency. Don't send a currency code. The API has no upper limit, but limits on your merchant account may apply.

rebill_date

String YYYY-MM-DD HH:MM:SS (24-hour time) or YYYY-MM-DD

The date and time of the next rebill, in UTC. If you send only a date, the time is 00:00:00. If the date has already passed, the rebill is processed right away, or as soon as a paused subscription resumes. See Pause and resume rebills.

period_type

String INTERVAL, SAME_DAY_MONTH How often rebills occur. Use INTERVAL to rebill every set number of days, or SAME_DAY_MONTH to rebill on the same date each month.

date_value

Integer See description With INTERVAL, the number of days between rebills, such as 30. With SAME_DAY_MONTH, the date of the month, such as 15. If a month doesn't have that date, the rebill runs on the month's last day, then returns to the original date the next month.

Status and flex parameters

These aren't part of the schedule set, so you can send them with or without the schedule parameters. If you leave one out, its current setting stays the same.

Parameter Type Accepted values Description

rebill_status

String

Paused, Active

Set to Paused to stop the subscriber's rebills. Set to Active to resume them. See Pause and resume rebills.

flex_enabled

Boolean true, false Set to true with a flex_terms_id to apply or change flex terms. Set to false to remove flex terms from the subscription. See Flex terms.

flex_terms_id

Integer Provided by Segpay Gateway support The ID of the flex terms to apply. To get your flex terms IDs, email gatewaysupport@segpay.com. The ID must be active and valid for the subscriber's account.

Responses

This endpoint uses standard HTTP status codes. A status in the 2xx range, such as 200 OK, means the update was applied. Any other status means it failed.

Status codes

Status code Meaning
200 OK The update was applied.
401 Unauthorized The API token is missing or invalid. See Authentication.
403 Forbidden You aren't permitted to make this update.
422 Unprocessable Entity One or more values in the request are invalid. The errors object in the response names the parameters at fault.
Any other status The update failed. Send the trace_id from the response to gatewaysupport@segpay.com.

Success (200)

A successful update returns a response like this:

Response
{
  "data": [],
  "status": "success",
  "code": 200,
  "trace_id": "a2ed2425-f5c6-436a-beab-f051c1371cde",
  "message": "Success"
}

Missing or invalid token (401)

A status of 401 Unauthorized means the request's API token is missing or invalid, and the update wasn't applied.

Response
{
  "data": {
    "resource": null,
    "field": null,
    "errors": [
      "Unauthorized",
      "Unauthorized"
    ]
  },
  "status": "error",
  "code": 401,
  "trace_id": "a2ed249b-a640-4dcf-b63f-f30c6e78d1f7",
  "message": "Unauthorized"
}

Invalid parameters (422)

A status of 422 Unprocessable Entity means the update wasn't applied because one or more values were invalid. The errors object names the parameters at fault. In this example, the rebill_amount is in an invalid format:

Response
{
  "data": {
    "resource": null,
    "field": null,
    "errors": {
      "rebill_amount": [
        "Invalid amount format"
      ]
    }
  },
  "status": "error",
  "code": 422,
  "trace_id": "a2ed23f4-65ca-4d80-a065-f4c6a1827730",
  "message": "Invalid Data"
}

If flex_terms_id is invalid, the errors object currently names flex_term_id instead. If your code looks up errors by parameter name, check for both.

Retries

If a request times out, you may not know whether it was applied. Most requests are safe to send again: sending the same request twice gives the same result as sending it once. The subscriber's record in the Gateway admin will show a note for each request.

A request with a rebill_date that has already passed isn't safe to resend without checking first. If the rebill from the first request was already processed, the resend causes a second rebill the next day.

To avoid this, send rebill_date with a time at least 1 hour in the future. Then you can safely resend the request until that time.

If a request with a past rebill date times out:

  1. Wait 15 minutes. A rebill can take up to 15 minutes to be processed.

  2. Open the subscriber's details in the Gateway admin (see Confirm a change), and check whether the subscriber was rebilled.

  3. If not, send the request again.

Event notifications

Pause, resume, and update requests don't send event notifications (postbacks). If your system relies on postbacks to track subscriptions, record each change in your own system when the request returns 200 OK.

Confirm a change

A 200 OK response means the change was applied. Each successful change also adds a note to the subscriber's record in the Gateway admin, showing the new values. To view it:

  1. Log in to the Gateway admin at admin.segpay.com.

  2. Go to Search.

  3. In the Search field, enter the subscriber ID, and click the Subscriber ID button.

    Search field in the Gateway admin with a subscriber ID entered, and the Subscriber ID button among the search options below it

  4. Click Perform Search.

  5. In the results, click the subscriber ID.

  6. In the side panel that opens, click View Subscriber Details.

  7. Find the note for the change at the bottom of the page in the Notes section.

    Notes section of the subscriber details page, with two Rebill Update notes: one for a pause, and one for a resume that lists the new rebill values

Support

Email gatewaysupport@segpay.com to:

  • Request access to this endpoint.

  • Set up testing.

  • Request a new API token.

  • Get your flex terms IDs.

  • Report a failed request. Include the trace_id from the response.

Related topics