Create subscriber
Create a link to the payment window, where the payer
saves their card, so that you can
charge it later. Only the payer can
save it, so this is the only way to create a subscriber. It is the
request that creates a payment
link, with a "subscriber".
Request
POST https://The URL names no shop: the request is for the shop whose
API key it has. 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
| Field | Type | Description |
|---|---|---|
subscriber |
object, required | Makes the link one where the payer saves their card. It may be empty, {}. |
subscriber.ref |
string | Your reference for the subscriber, such as your customer ID, which seq returns with the subscriber and with each of its charges. We don't check that it is unique, and store it as it is: to change a subscriber's card, renew it rather than create another. |
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. |
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 billing address, which seq returns with the subscriber, and with each charge that gives none of its own. See Addresses. |
shipping |
object | The shipping address, likewise. |
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
A link where the payer saves their card, and pays the first month:
curl https://api.gjold.com/v1/new \
-u {apikey} \
-d @create.json
{
"subscriber": {
"ref": "user7192"
},
"orderid": "M-7192-2026-11",
"items": [
{
"name": "Membership, first month",
"total": "99 DKK"
}
],
"billing": {
"name": "Anne Jensen",
"email": "anne@example.com"
},
"successurl": "https://shop.example/welcome?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. |
No subscriber exists yet. We create it when the payer has saved their
card, and seq returns it then, with your "ref" and the "id"
by which you charge it. If the link expires unused, there is no
subscriber, and seq returns 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 invalid item total currency |
An item's total is in a currency that is not in the ISO 4217 table. Fix the request. |
500 {why} |
Any other failure: we could not create the link just now. Try again. |
Without "subscriber", the request makes a payment link, which fails
with 500 missing items if there are no "items": see
Create payment link.
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.
See also
Subscribers, Charge subscriber, Renew subscriber, Charging subscribers, and in the knowledge base, Stored credentials.