Renew subscriber
Create a link to the payment window, where the payer
saves a new card for a subscriber: when theirs has expired, or a
charge failed for good. The subscriber keeps
its "id" and "ref", so you charge it as
before.
Request
POST https://{subid}is the subscriber's"id", from seq.
The key needs the payid permission.
Headers
| HTTP header | Description |
|---|---|
Authorization |
Required. Your API key, after |
Content-Type |
application/json. We don't check it. |
Fields
An address you send replaces the subscriber's, and one you leave out stays as it is.
| Field | Type | Description |
|---|---|---|
items |
array | A first charge, for the payer to pay as they save their card: one or more items, in one currency. See First charge. For a renewal after a failed charge, this is often what the payer owes. |
items[].total |
amount, required | The price of the item, its whole quantity together, as a string with
its currency, as |
items[].quantity |
integer | How many, a positive integer. The default is |
items[].name |
string | The name of the product or service, for your records and the dashboard. The payment window does not show it. |
items[].sku |
string | Your SKU for the product. We accept it, but don't store it, so seq does not return it. |
orderid |
string | Your ID for the order that the first charge pays, which seq returns with the charge, and the acquirer passes to the payer's bank as its reference, as for a payment link. |
autocapture |
boolean | Capture the first charge as soon as it is authorized. By default,
|
billing |
object | The payer's new billing address. See Addresses. |
shipping |
object | The new shipping address. |
successurl |
string | Where the payment window sends the payer when they have paid, with a
|
language |
string | The payment window's language: |
lifetime |
string | How long the link can be paid: a whole number and a unit, |
First charge
With "items", the payer pays a first charge as they save their card,
such as a subscription's first month: one payment, authorized together
with saving the card, for the items' total. If it fails, nothing is
saved, and the payer can try again in the window. Seq returns it as a
charge of the subscriber, after the
subscriber, with the "orderid" and items of this request. If the
bank approves only part of it, the charge is for that part, unless it
has "autocapture", which declines it: check totals.authorized.
Without "items", the payer only saves their card, and is charged
nothing. "orderid" and "autocapture" are for the first charge, and
do nothing without it.
Example
curl https://api.gjold.com/v1/subscribers/19/renew \
-u {apikey} \
-d @renew.json
{
"orderid": "M-7192-2026-12",
"items": [
{
"name": "Membership, December",
"total": "99 DKK"
}
],
"successurl": "https://shop.example/renewed?user=7192"
}
Response
We answer 200 OK with the link, as
Create payment link does:
| Field | Type | Description |
|---|---|---|
url |
string | The link: the payment window's address, to send the payer to. Its last part is the link's ID: see The link's ID. |
The subscriber is not renewed yet. It is when the payer has saved their
new card: seq then returns the subscriber with its new
"method", a "renew" in its "acts",
and its "rev" one higher. Until then, the old card is charged as
before, if it still works. A link that expires unused changes nothing.
Link parameters
The payment window offers the payment methods that can be saved: cards, and Apple Pay. MobilePay can't be saved, so it is not offered, and a subscriber's link takes no link parameters. The window always asks the payer's bank for 3-D Secure when they save a card, as the card schemes require of a stored card's first payment; Apple Pay authenticates on the device.
Errors
Besides the errors that any request can give, which Errors lists:
| Status and message | Description |
|---|---|
400 invalid json in {where}: {why} |
The body is not JSON, or an item's total can't be read, has no currency, or is in another currency than the items before it. See Invalid JSON. |
500 open subscriber {subid} failed: {why} |
The shop has no subscriber with that {subid}. Check it: a retry fails the same way. |
500 invalid item total currency |
An item's total is in a currency that is not in the ISO 4217 table. |
500 {why} |
Any other failure: we could not create the link just now. Try again. |
A declined card is not an error of this request: the payer sees the
decline in the payment window, and can try again there until the link
expires. The request takes no Idempotency-Key, so a retry after a
broken connection can create a second link. That does no harm, as no
one has the first link's URL, and it expires unpaid.
When to ask the payer to renew, before their card expires or after a charge fails, is in the note Charging subscribers.