POST /api/merchant/purchase/startconst url = new URL("/api/merchant/purchase/start");
const response = await fetch(url, { method: "POST" });from urllib.request import urlopen
response = urlopen("/api/merchant/purchase/start")// POST /api/merchant/purchase/start
$url = "/api/merchant/purchase/start";// POST /api/merchant/purchase/start
String url = "/api/merchant/purchase/start";/api/merchant/purchase/startAPI that allows you to integrate a single secure payment for your website.
Use this endpoint to initiate the order process for a single purchase.
Response of this endpoint sessionId has to be passed to the
Yoursafe Flowguard SDK to start the payment process.
This endpoint is secured by JWTs. You can find more information how to work with JWTs in the Security section.
JWT Payload
JWT payload has to contain the following fields:
| Field | Field type | Note |
|---|---|---|
| shopId | number or string | Shop ID from ControlCenter. |
| priceAmount | string | In format NNN.NN |
| priceCurrency | string | One of: USD, EUR, GBP, AUD, CAD, CHF, DKK, NOK, SEK |
| successUrl | string | Max length 255 characters. |
| declineUrl | string | Max length 255 characters. |
| postbackUrl | string | Max length 255 characters. |
| string | Max length 100 characters. | |
| referenceId | string or null | Optional. Max length 100 characters. |
JWT Example
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaG9wSWQiOiI2NTE1MSIsInByaWNlQW1vdW50IjoiMTAuMDAiLCJwcmljZUN1cnJlbmN5IjoiVVNEIiwic3VjY2Vzc1VybCI6Imh0dHBzOi8vbWVyY2hhbnQuY29tL3N1Y2Nlc3MiLCJkZWNsaW5lVXJsIjoiaHR0cHM6Ly9tZXJjaGFudC5jb20vZGVjbGluZSIsInBvc3RiYWNrVXJsIjoiaHR0cHM6Ly9tZXJjaGFudC5jb20vcG9zdGJhY2siLCJlbWFpbCI6InNob3BlckBleGFtcGxlLmNvbSJ9.J8LY9lYSI9HWAiZPjXKLZ7dXIMno9CBIRt5fk9M5gOM
Request bodyrequired
application/jwt
DatastringrequiredResponses
Successful Response
sessionIduuidrequiredUnauthorized
errorsstringrequiredUnprocessable Content
errorsobjectrequiredLocked
errorsstringrequiredPOST /api/merchant/subscription/cancelconst url = new URL("/api/merchant/subscription/cancel");
const response = await fetch(url, { method: "POST" });from urllib.request import urlopen
response = urlopen("/api/merchant/subscription/cancel")// POST /api/merchant/subscription/cancel
$url = "/api/merchant/subscription/cancel";// POST /api/merchant/subscription/cancel
String url = "/api/merchant/subscription/cancel";/api/merchant/subscription/cancelThis endpoint is used to cancel a subscription.
This endpoint is secured by JWTs. You can find more information how to work with JWTs in the Security section.
JWT Payload
JWT payload has to contain the following fields:
| Field | Field type | Note |
|---|---|---|
| saleId | number or string | Sale ID of subscription to cancel. |
| shopId | number or string | Shop ID from ControlCenter. |
| cancelledBy | string | Optional, one of: merchant, buyer |
JWT Example
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaG9wSWQiOiI2NTE1MSIsInNhbGVJZCI6IjIwODAiLCJjYW5jZWxsZWRCeSI6Im1lcmNoYW50In0.gAbebyxDsecJrriAosWvtdi-SG_dt6MTVMC6NmOGriE
Request bodyrequired
application/jwt
DatastringrequiredResponses
Successful Response
Unauthorized
errorsstringrequiredUnprocessable Content
errorsobjectrequiredPOST /api/merchant/subscription/startconst url = new URL("/api/merchant/subscription/start");
const response = await fetch(url, { method: "POST" });from urllib.request import urlopen
response = urlopen("/api/merchant/subscription/start")// POST /api/merchant/subscription/start
$url = "/api/merchant/subscription/start";// POST /api/merchant/subscription/start
String url = "/api/merchant/subscription/start";/api/merchant/subscription/startUse this endpoint to initiate the subscription process.
Response of this endpoint sessionId has to be passed to the
Yoursafe Flowguard SDK to start the payment process.
This endpoint is secured by JWTs. You can find more information how to work with JWTs in the Security section.
JWT Payload
JWT payload has to contain the following fields:
| Field | Field type | Note |
|---|---|---|
| shopId | number or string | Shop ID from ControlCenter. |
| priceAmount | string | In format NNN.NN |
| priceCurrency | string | One of: USD, EUR, GBP, AUD, CAD, CHF, DKK, NOK, SEK |
| successUrl | string | Max length 255 characters. |
| declineUrl | string | Max length 255 characters. |
| postbackUrl | string | Max length 255 characters. |
| string | Max length 100 characters. | |
| subscriptionType | string | One of: recurring, one-time |
| period | string | In ISO 8601 period format (e.g. P30D, P1M, P1Y) |
| referenceId | string or null | Optional. Max length 100 characters. |
| trialAmount | string or null | Optional. In format NNN.NN |
| trialPeriod | string or null | Optional. In ISO 8601 period format (e.g. P30D, P1M, P1Y) |
Period format
Period consists of 3 parts (P, number, unit). Units can be: D - day, M - month, Y - year. For example:
- P30D - 30 days
- P1M - 1 month
- P1Y - 1 year
Minimum and maximum period restrictions
- for one-time subscription minimum period length is 2 days, maximum period length is 180 days
- for recurring subscription minimum period length is 7 days, maximum period length is 180 days
- maximum period can be prolonged up to 730 days if merchant has long subscriptions enabled
Minimum and maximum trialPeriod restrictions
- minimum trialPeriod length is 2 days, maximum trialPeriod length is 180 days
- maximum trialPeriod can be prolonged up to 730 days if merchant has long subscriptions enabled
JWT Example
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaG9wSWQiOiI2NTE1MSIsInByaWNlQW1vdW50IjoiMTAuMDAiLCJwcmljZUN1cnJlbmN5IjoiVVNEIiwic3VjY2Vzc1VybCI6Imh0dHBzOi8vbWVyY2hhbnQuY29tL3N1Y2Nlc3MiLCJkZWNsaW5lVXJsIjoiaHR0cHM6Ly9tZXJjaGFudC5jb20vZGVjbGluZSIsInBvc3RiYWNrVXJsIjoiaHR0cHM6Ly9tZXJjaGFudC5jb20vcG9zdGJhY2siLCJlbWFpbCI6InNob3BlckBleGFtcGxlLmNvbSIsInN1YnNjcmlwdGlvblR5cGUiOiJyZWN1cnJpbmciLCJwZXJpb2QiOiJQMU0iLCJ0cmlhbEFtb3VudCI6IjUuMDAiLCJ0cmlhbFBlcmlvZCI6IlAzRCJ9.EwpofyMOWGqqmk4RQU7DgQHWCxl32GQLckrNOnHBSy4
Request bodyrequired
application/jwt
DatastringrequiredResponses
Successful Response
sessionIduuidrequiredUnauthorized
errorsstringrequiredUnprocessable Content
errorsobjectrequiredLocked
errorsstringrequired