Register payment

Subscription API v1
POST*base*/subscription/payment
Authentication:API key

This will complete the subscription. Often called when user comes back to payment_url from /subscription/order. All GET/POST-params sent by the payment plugin needs to be attached to this call.

Parameters

id

string
required
The subscription ID from Create Subscription.

payment

string
required
URI of payment plugin to be used. Needs to be set up before as a payment plugin for the store.
[all GET/POST params sent by payment provider] Attach all GET/POST parameters sent from the payment provider to the payment_url from Create Subscription. These will be used to validate if the payment was successful.

Request examples

1
2
3
4
POST <base>/subscription/payment HTTP/1.1
Content-Type: application/x-www-form-urlencoded

id=3&payment=nets&[+all GET/POST params sent by payment provider]

Response

200 Content-type: application/json

status

string
required
ok if success, else a message explaining what went wrong.

id

int
required
The ID of the subscription that was created.

amount

decimal2 (0.00)
required
The total value of the subscription.

shipping

decimal2 (0.00)
required
The shipping value for the first order of the subscription.

itemCount

int
required
The total amount of products in the subscription.

currency

string
The currency that the subscription was registered with, SEK, USD, EUR, etc.

address

object

An address object with the customer information.

firstName lastName

string
The name of the customer.

address coaddress city state zipcode phoneNumber

string
The customer’s address information.

country

string
The country of the customer. ISO-Alpha-2 (SE, US, GB etc)

error

boolean
optional
If true, the payment was not successful. The status should contain information on why.

Response example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
{
  "status": "ok",
  "id": 3,
  "amount": 900,
  "shipping": 20,
  "itemCount": 2,
  "currency": "SEK",
  "address": {
    "firstName": "Kalle",
    "lastName": "Anka",
    "phoneNumber": "+4687203333",
    "address1": "Malarvarvsbacken 8",
    "address2": "c/o Young Skilled AB",
    "zipCode": "11733",
    "city": "Stockholm",
    "state": "",
    "country": "SE"
  }
}

Error example

1
2
3
4
{
  "status": "Could not register customer",
  "error": true
}