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¶
string
required
|
The subscription ID from Create Subscription. |
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
string
required
|
ok if success, else a message explaining what went wrong. |
||||||
int
required
|
The ID of the subscription that was created. | ||||||
decimal2 (0.00)
required
|
The total value of the subscription. | ||||||
decimal2 (0.00)
required
|
The shipping value for the first order of the subscription. | ||||||
int
required
|
The total amount of products in the subscription. | ||||||
string
|
The currency that the subscription was registered with, SEK , USD , EUR , etc. |
||||||
object
|
An address object with the customer information.
|
||||||
string
|
The date in Y-m-d H-i-s format when the subscription was created. |
||||||
string
|
The date in Y-m-d format when the subscription starts. |
||||||
string
|
The date in Y-m-d format when the subscription has next shipping. |
||||||
int
|
The interval between each subscription. Depending on intervaltype it will be months or days. | ||||||
string
|
The type of interval for the subscription.
|
||||||
string
|
Html snippet that contains a receipt for a subscription payment. Is not null for Klarna payments. | ||||||
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 20 21 22 23 24 25 | {
"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¶
1 2 3 4 | {
"status": "Could not register customer",
"error": true
}
|