Subscription API - Register payment
Register payment
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
The subscription ID from :doc: Create Subscription
URI of payment plugin to be used. Needs to be set up before as a payment plugin for the store.
Attach all GET/POST parameters sent from the payment provider to the payment_url
from :doc: Create Subscription. These will be used to validate if the payment was successful.
Request example
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
ok
if success, else a message explaining what went wrong.
The ID of the subscription that was created.
The total value of the subscription.
The shipping value for the first order of the subscription.
The total amount of products in the subscription.
The currency that the subscription was registered with, SEK
, USD
, EUR
, etc.
An address object with the customer information.
The name of the customer.
The customer's address information.
The country of the customer. ISO-Alpha-2 (SE
, US
, GB
etc)
The date in Y-m-d H-i-s
format when the subscription was created.
The date in Y-m-d
format when the subscription starts.
The date in Y-m-d
format when the subscription has next shipping.
The interval between each subscription. Depending on intervaltype
it will be months or days.
The type of interval for the subscription
Month
interval is in months.Day
interval is in days.
Html snippet that contains a receipt for a subscription payment. Is not null for Klarna payments.
If true
, the payment was not successful. The status
should contain information on why.
Response examples
HTTP/1.1 200 OK
Content-type: application/json
{
"status": "ok",
"id": 3,
"amount": "900.00",
"shipping": "20.00",
"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"
},
"createdAt": "2020-05-05 15:00:00",
"startDate": "2020-05-05",
"nextOrderDate": "2020-05-06",
"interval": 14,
"intervalType": "Day",
"receipt": "<div>...</div>"
}
Error example
HTTP/1.1 200 OK
Content-type: application/json
{
"status": "Could not register customer",
"error": true
}