Ensure that all API calls are made with TLS 1.1 or higher.
/Accounts
/RecurringSubscriptions
/RecurringSubscriptions/{id}
/RecurringSubscriptions?{status}
/RecurringPayments
/RecurringPayments/{id}
/RecurringPayments?{status}
The authorization used is basic authentication and you need an Agent ID and an API Key to call these methods.
The Agent ID and an API Key are used to create an auth-string which is used in the message headers to authorize calls.
Auth-string = Base64 representation of “Agent ID:API Key”
Example
Agent ID = 4
API Key = 2acab30d-fe50-426f-90d7-8c60a7eb31d4
Combined these give us a credential string:
4:2acab30d-fe50-426f-90d7-8c60a7eb31d4
Which base64-encoded gives us the auth-string:
NDoyYWNhYjMwZC1mZTUwLTQyNmYtOTBkNy04YzYwYTdlYjMxZDQ=
Request
GET https://test-api.payson.se/2.0/Accounts Host: test-api.payson.se Authorization: Basic NDoyYWNhYjMwZC1mZTUwLTQyNmYtOTBkNy04YzYwYTdlYjMxZDQ= Content-Type: application/json
Response Codes | Status | Description |
---|---|---|
200 | Ok | The call was successful. The requested resource will be returned in the response body. |
401 | Unauthorized | The authorization failed. |
Response
HTTP/1.1 200 OK Content-Type: application/json
{ "accountEmail":"testagent-checkout2@payson.se", "status":"Approved", "merchantId":4, "enabledForInvoice":true, "enabledForpaymentPlan":true, "enabledForRecurringPayments":true }
Request
POST https://test-api.payson.se/2.0/RecurringSubscriptions Host: test-api.payson.se Authorization: Basic NDoyYWNhYjMwZC1mZTUwLTQyNmYtOTBkNy04YzYwYTdlYjMxZDQ= Content-Type: application/json
{ "customer":{ (customer object, optional) "city": (string, optional), "countryCode": (string, optional), "identityNumber": (string, optional), "email": (string, optional), "firstName": (string, optional), "lastName": (string, optional), "phone": (string, optional), "postalCode": (string, optional), "street": (string, optional), "type": (string, optional) }, "agreement":{ (agreement object, required) "currency": (string, required) }, "merchant":{ (merchant object, required) "checkoutUri": (string, required), "confirmationUri": (string, required), "notificationUri": (string, required), "termsUri": (string, required), "partnerId": (string, optional), "validationUri": (string, optional), "integrationInfo": (string, optional), "reference": (string, optional) }, "gui":{ (gui object, optional) "colorScheme": (string, optional), "locale": (string, optional), "requestPhone": (boolean, optional), "phoneOptional": (boolean, optional), "verification": (string, optional), "countries": (array, optional) } }
{ "merchant":{ "checkoutUri":"https://www.examplestore.com/checkout.php", "confirmationUri":"https://www.examplestore.com/confirmation.php", "notificationUri":"https://www.examplestore.com/notification.php", "termsUri":"https://www.examplestore.com/terms.php" }, "agreement":{ "currency":"sek" } }
Response Codes | Status | Description |
---|---|---|
201 | Created | The call was successful. The created resource will be returned in the response body. |
400 or 500 | Bad request | The call failed. Look at the returned JSON-object in the response body for more information. |
401 | Unauthorized | The authorization failed. |
Response
HTTP/1.1 201 Created Location: https://test-api.payson.se/2.0/RecurringSubscriptions/bfac7c19-d3cc-4f65-938c-a9d700d1d24f
{ "status": "created", "id": "bfac7c19-d3cc-4f65-938c-a9d700d1d24f", "snippet": "<div id='paysonContainer' url='https://test-www.payson.se/embedded/recurring?id=bfac7c19-d3cc-4f65-938c-a9d700d1d24f'></div><script type='text/javascript' src='https://test-www.payson.se/embedded/Content/payson.js?v2'></script>", "agreement": { "currency": "sek" }, "customer": { "city": null, "countryCode": null, "identityNumber": null, "email": null, "firstName": null, "lastName": null, "phone": null, "postalCode": null, "street": null, "type": "person" }, "merchant": { "checkoutUri": "https://www.examplestore.com/checkout.php", "confirmationUri": "https://www.examplestore.com/confirmation.php", "partnerId": null, "notificationUri": "https://www.examplestore.com/notification.php", "validationUri": null, "termsUri": "https://www.examplestore.com/terms.php", "integrationInfo": null, "reference": null }, "gui": { "colorScheme": "white", "locale": "en", "requestPhone": false, "phoneOptional": false, "verification": "none", "countries": null }, "history": { "created": "2019-01-16T13:43:56", "awaitingSubscription": null, "customerSubscribed": null, "customerUnsubscribed": null, "canceled": null, "expired": null }, "links": [ { "href": "https://test-api.payson.se/2.0/RecurringSubscriptions/bfac7c19-d3cc-4f65-938c-a9d700d1d24f", "rel": "self" } ] }
Request
GET https://test-api.payson.se/2.0/RecurringSubscriptions/bfac7c19-d3cc-4f65-938c-a9d700d1d24f Host: test-api.payson.se Authorization: Basic NDoyYWNhYjMwZC1mZTUwLTQyNmYtOTBkNy04YzYwYTdlYjMxZDQ=
Response Codes | Status | Description |
---|---|---|
200 | Ok | The call was successful. The resource will be returned in the response body. |
401 | Unauthorized | The authorization failed. |
404 | Not found | The requested resource was not found. |
Response
HTTP/1.1 200 OK Content-Type: application/json
{ "status": "created", "id": "bfac7c19-d3cc-4f65-938c-a9d700d1d24f", "snippet": "<div id='paysonContainer' url='https://test-www.payson.se/embedded/recurring?id=bfac7c19-d3cc-4f65-938c-a9d700d1d24f'></div><script type='text/javascript' src='https://test-www.payson.se/embedded/Content/payson.js?v2'></script>", "agreement": { "currency": "sek" }, "customer": { "city": null, "countryCode": null, "identityNumber": null, "email": null, "firstName": null, "lastName": null, "phone": null, "postalCode": null, "street": null, "type": "person" }, "merchant": { "checkoutUri": "https://www.examplestore.com/checkout.php", "confirmationUri": "https://www.examplestore.com/confirmation.php", "partnerId": null, "notificationUri": "https://www.examplestore.com/notification.php", "validationUri": null, "termsUri": "https://www.examplestore.com/terms.php", "integrationInfo": null, "reference": null }, "gui": { "colorScheme": "white", "locale": "en", "requestPhone": false, "phoneOptional": false, "verification": "none", "countries": null }, "history": { "created": "2019-01-16T13:43:56", "awaitingSubscription": null, "customerSubscribed": null, "customerUnsubscribed": null, "canceled": null, "expired": null }, "links": [ { "href": "https://test-api.payson.se/2.0/RecurringSubscriptions/bfac7c19-d3cc-4f65-938c-a9d700d1d24f", "rel": "self" } ] }
Request
PUT https://test-api.payson.se/2.0/RecurringSubscriptions/bfac7c19-d3cc-4f65-938c-a9d700d1d24f Host: test-api.payson.se Authorization: Basic NDoyYWNhYjMwZC1mZTUwLTQyNmYtOTBkNy04YzYwYTdlYjMxZDQ= Content-Type: application/json
{ "status": "created", "id": "bfac7c19-d3cc-4f65-938c-a9d700d1d24f", "agreement": { "currency": "sek" }, "merchant": { "checkoutUri": "https://www.examplestore.com/checkout.php", "confirmationUri": "https://www.examplestore.com/confirmation.php", "notificationUri": "https://www.examplestore.com/notification.php", "termsUri": "https://www.examplestore.com/terms.php", }, "gui": { "colorScheme": "gray" } }
Response Codes | Status | Description |
---|---|---|
200 | Ok | The call was successful. The updated resource will be returned in the response body. |
400 | Bad request | The call failed. Look at the returned JSON-object in the response body for more information. |
401 | Unauthorized | The authorization failed. |
Response
HTTP/1.1 200 OK Location: https://test-api.payson.se/2.0/RecurringSubscriptions/a273a0b8-402c-428f-99a0-a93f00df6bf6 Content-Type: application/json
{ "status": "created", "id": "bfac7c19-d3cc-4f65-938c-a9d700d1d24f", "snippet": "<div id='paysonContainer' url='https://test-www.payson.se/embedded/recurring?id=bfac7c19-d3cc-4f65-938c-a9d700d1d24f'></div><script type='text/javascript' src='https://test-www.payson.se/embedded/Content/payson.js?v2'></script>", "agreement": { "currency": "sek" }, "customer": { "city": null, "countryCode": null, "identityNumber": null, "email": null, "firstName": null, "lastName": null, "phone": null, "postalCode": null, "street": null, "type": "person" }, "merchant": { "checkoutUri": "https://www.examplestore.com/checkout.php", "confirmationUri": "https://www.examplestore.com/confirmation.php", "partnerId": null, "notificationUri": "https://www.examplestore.com/notification.php", "validationUri": null, "termsUri": "https://www.examplestore.com/terms.php", "integrationInfo": null, "reference": null }, "gui": { "colorScheme": "gray", "locale": "en", "requestPhone": false, "phoneOptional": false, "verification": "none", "countries": null }, "history": { "created": "2019-01-16T13:43:56", "awaitingSubscription": null, "customerSubscribed": null, "customerUnsubscribed": null, "canceled": null, "expired": null }, "links": [ { "href": "https://test-api.payson.se/2.0/RecurringSubscriptions/bfac7c19-d3cc-4f65-938c-a9d700d1d24f", "rel": "self" } ] }
Request
GET https://test-api.payson.se/2.0/RecurringSubscriptions?status=customerSubscribed Host: test-api.payson.se Authorization: Basic NDoyYWNhYjMwZC1mZTUwLTQyNmYtOTBkNy04YzYwYTdlYjMxZDQ= Content-Type: application/json
Response Codes | Status | Description |
---|---|---|
200 | Ok | The call was successful. The requested resource will be returned in the response body. |
400 | Bad request | The call failed. Look at the returned JSON-object in the response body for more information. |
401 | Unauthorized | The authorization failed. |
Response
HTTP/1.1 200 OK Content-Type: application/json
{ "pageSize": 20, "page": 1, "totalPages": 1, "count": 13, "totalCount": 13, "data": [ { "status": "customerSubscribed", "id": "4faba7e7-9913-48a4-81e8-a9a100e348ea", "snippet": "<div id='paysonContainer' url='https://test-www.payson.se/embedded/recurring?id=4faba7e7-9913-48a4-81e8-a9a100e348ea'></div><script type='text/javascript' src='https://test-www.payson.se/embedded/Content/payson.js?v2'></script>", "agreement": { "currency": "sek" }, "customer": { "city": "Stan", "countryCode": "SE", "identityNumber": "4605092222", "email": "test@payson.se", "firstName": "Tess", "lastName": "Persson", "phone": null, "postalCode": "99999", "street": "Testgatan 1", "type": "person" }, "merchant": { "checkoutUri": "https://demoshop.payson.se/2.0/apidemo/Checkout/Recurring/14", "confirmationUri": "https://demoshop.payson.se/2.0/apidemo/Confirmation/Recurring/14", "partnerId": null, "notificationUri": "https://demoshop.payson.se/2.0/apidemo/Notification/Recurring/14", "validationUri": null, "termsUri": "https://demoshop.payson.se/2.0/apidemo/Terms", "integrationInfo": null, "reference": null }, "gui": { "colorScheme": "white", "locale": "sv", "requestPhone": false, "phoneOptional": false, "verification": "none", "countries": null }, "history": { "created": "2018-11-23T14:47:30", "awaitingSubscription": "2018-11-23T14:47:45", "customerSubscribed": "2018-11-23T14:48:03", "customerUnsubscribed": null, "canceled": null, "expired": null }, "links": [ { "href": "https://test-api.payson.se/2.0/RecurringSubscriptions/4faba7e7-9913-48a4-81e8-a9a100e348ea", "rel": "self" } ] }, { "status": "customerSubscribed", "id": "dafd580e-3bd1-4aa7-bab3-a9cb00b513fa", "snippet": "<div id='paysonContainer' url='https://test-www.payson.se/embedded/recurring?id=dafd580e-3bd1-4aa7-bab3-a9cb00b513fa'></div><script type='text/javascript' src='https://test-www.payson.se/embedded/Content/payson.js?v2'></script>", "agreement": { "currency": "sek" }, "customer": { "city": "Stan", "countryCode": "SE", "identityNumber": "4605092222", "email": "tess.t.persson@test.se", "firstName": "Tess", "lastName": "Persson", "phone": null, "postalCode": "99999", "street": "Testgatan 1", "type": "person" }, "merchant": { "checkoutUri": "http://localhost/paysonsandbox/example/recurring-subscription-create.php", "confirmationUri": "http://localhost/paysonsandbox/example/confirmation.php?ref=prp", "partnerId": null, "notificationUri": "http://localhost/paysonsandbox/example/notification.php?ref=prp", "validationUri": null, "termsUri": "http://localhost/paysonsandbox/example/terms.php", "integrationInfo": null, "reference": null }, "gui": { "colorScheme": "white", "locale": "sv", "requestPhone": false, "phoneOptional": false, "verification": "none", "countries": null }, "history": { "created": "2019-01-04T11:59:16", "awaitingSubscription": "2019-01-04T11:59:25", "customerSubscribed": "2019-01-04T11:59:27", "customerUnsubscribed": null, "canceled": null, "expired": null }, "links": [ { "href": "https://test-api.payson.se/2.0/RecurringSubscriptions/dafd580e-3bd1-4aa7-bab3-a9cb00b513fa", "rel": "self" } ] } ] }
Request
POST https://test-api.payson.se/2.0/RecurringPayments Host: test-api.payson.se Authorization: Basic NDoyYWNhYjMwZC1mZTUwLTQyNmYtOTBkNy04YzYwYTdlYjMxZDQ=
{ "subscriptionId": (subscription id, required), "notificationUri": (string, required), "expirationDate": (string, required), "order":{ (order object, required) "currency": (string, required), "items":[ (array, required) { "name": (string, required), "unitPrice": (decimal, required), "quantity": (decimal, required), "taxRate": (decimal, optional), "reference": (string, optional), "discountRate": (decimal, optional), "ean": (string, optional), "imageUri": (string, optional), "type": (string, optional), "uri": (string, optional) } ] }, "description": (string, optional) }
{ "subscriptionId": "5d4961bd-d800-4353-9e0a-a9d500a16e54", "notificationUri": "https://www.examplestore.com/notification.php", "expirationDate" : "2030-01-01T13:37:00", "order": { "currency": "sek", "items": [ { "name": "Product 1", "unitPrice": 150.00, "quantity": 1.00, "taxRate": 0.25 } ] } }
Response Codes | Status | Description |
---|---|---|
200 | Ok | The call was successful. The resource will be returned in the response body. |
401 | Unauthorized | The authorization failed. |
404 | Not found | The requested resource was not found. |
Response
HTTP/1.1 200 OK Content-Type: application/json
{ "id": "1e5a7ce0-008b-4421-8c34-a9d8009b27cc", "created": "2019-01-17T10:24:54", "subscriptionId": "5d4961bd-d800-4353-9e0a-a9d500a16e54", "expirationDate" : "2030-01-01T13:37:00", "purchaseId": 3808235, "order": { "currency": "sek", "totalFeeExcludingTax": 4.5, "totalFeeIncludingTax": 5.63, "totalPriceExcludingTax": 120, "totalPriceIncludingTax": 150, "totalTaxAmount": 30, "totalCreditedAmount": 0, "items": [ { "itemId": "ffd6e0e3-c4fd-4ad2-b425-a9d8009b27cc", "discountRate": 0, "ean": null, "imageUri": null, "name": "Product 1", "quantity": 1, "reference": null, "taxRate": 0.25, "totalPriceExcludingTax": 120, "totalPriceIncludingTax": 150, "totalTaxAmount": 30, "creditedAmount": 0, "type": "physical", "unitPrice": 150, "uri": null } ] }, "description": null, "notificationUri": null, "status": "processingPayment", "links": [ { "href": "https://test-api.payson.se/2.0/RecurringPayments/1e5a7ce0-008b-4421-8c34-a9d8009b27cc", "rel": "self" } ] }
Request
GET https://test-api.payson.se/2.0/RecurringPayments/1e5a7ce0-008b-4421-8c34-a9d8009b27cc Host: test-api.payson.se Authorization: Basic NDoyYWNhYjMwZC1mZTUwLTQyNmYtOTBkNy04YzYwYTdlYjMxZDQ=
Response Codes | Status | Description |
---|---|---|
200 | Ok | The call was successful. The resource will be returned in the response body. |
401 | Unauthorized | The authorization failed. |
404 | Not found | The requested resource was not found. |
Response
HTTP/1.1 200 OK Content-Type: application/json
{ "id": "1e5a7ce0-008b-4421-8c34-a9d8009b27cc", "created": "2019-01-17T10:24:54", "subscriptionId": "5d4961bd-d800-4353-9e0a-a9d500a16e54", "purchaseId": 3808235, "order": { "currency": "sek", "totalFeeExcludingTax": 4.5, "totalFeeIncludingTax": 5.63, "totalPriceExcludingTax": 120, "totalPriceIncludingTax": 150, "totalTaxAmount": 30, "totalCreditedAmount": 0, "items": [ { "itemId": "ffd6e0e3-c4fd-4ad2-b425-a9d8009b27cc", "discountRate": 0, "ean": null, "imageUri": null, "name": "Product 1", "quantity": 1, "reference": null, "taxRate": 0.25, "totalPriceExcludingTax": 120, "totalPriceIncludingTax": 150, "totalTaxAmount": 30, "creditedAmount": 0, "type": "physical", "unitPrice": 150, "uri": null } ] }, "description": null, "notificationUri": null, "status": "readyToShip", "links": [ { "href": "https://test-api.payson.se/2.0/RecurringPayments/1e5a7ce0-008b-4421-8c34-a9d8009b27cc", "rel": "self" } ] }
Request
PUT https://test-api.payson.se/2.0/RecurringPayments/1e5a7ce0-008b-4421-8c34-a9d8009b27cc Host: test-api.payson.se Authorization: Basic NDoyYWNhYjMwZC1mZTUwLTQyNmYtOTBkNy04YzYwYTdlYjMxZDQ=
{ "id": "1e5a7ce0-008b-4421-8c34-a9d8009b27cc", "created": "2019-01-17T10:24:54", "subscriptionId": "5d4961bd-d800-4353-9e0a-a9d500a16e54", "purchaseId": 3808235, "order": { "currency": "sek", "items": [ { "itemId": "ffd6e0e3-c4fd-4ad2-b425-a9d8009b27cc", "name": "Product 1", "quantity": 1, "taxRate": 0.25, "creditedAmount": 10, "unitPrice": 150 } ] }, "notificationUri": "https://www.examplestore.com/notification.php", "status": "shipped" }
Response Codes | Status | Description |
---|---|---|
200 | Ok | The call was successful. The resource will be returned in the response body. |
401 | Unauthorized | The authorization failed. |
404 | Not found | The requested resource was not found. |
Response
HTTP/1.1 200 OK Content-Type: application/json
{ "id": "1e5a7ce0-008b-4421-8c34-a9d8009b27cc", "created": "2019-01-17T10:24:54", "subscriptionId": "5d4961bd-d800-4353-9e0a-a9d500a16e54", "purchaseId": 3808235, "order": { "currency": "sek", "totalFeeExcludingTax": 4.5, "totalFeeIncludingTax": 5.63, "totalPriceExcludingTax": 120, "totalPriceIncludingTax": 150, "totalTaxAmount": 30, "totalCreditedAmount": 10, "items": [ { "itemId": "ffd6e0e3-c4fd-4ad2-b425-a9d8009b27cc", "discountRate": 0, "ean": null, "imageUri": null, "name": "Product 1", "quantity": 1, "reference": null, "taxRate": 0.25, "totalPriceExcludingTax": 120, "totalPriceIncludingTax": 150, "totalTaxAmount": 30, "creditedAmount": 10, "type": "physical", "unitPrice": 150, "uri": null } ] }, "description": null, "notificationUri": "https://www.examplestore.com/notification.php", "status": "shipped", "links": [ { "href": "https://test-api.payson.se/2.0/RecurringPayments/1e5a7ce0-008b-4421-8c34-a9d8009b27cc", "rel": "self" } ] }
Request
GET https://test-api.payson.se/2.0/RecurringPayments?status=readytoship Host: test-api.payson.se Authorization: Basic NDoyYWNhYjMwZC1mZTUwLTQyNmYtOTBkNy04YzYwYTdlYjMxZDQ= Content-Type: application/json
Response Codes | Status | Description |
---|---|---|
200 | Ok | The call was successful. The requested resource will be returned in the response body. |
400 | Bad request | The call failed. Look at the returned JSON-object in the response body for more information. |
401 | Unauthorized | The authorization failed. |
Response
HTTP/1.1 200 OK Content-Type: application/json
{ "pageSize": 20, "page": 1, "totalPages": 1, "count": 13, "totalCount": 13, "data": [ { "id": "0fb03b40-8a1b-4c4a-9c4b-a9d1010d2a3f", "created": "2019-01-10T17:20:00", "subscriptionId": "3ad8eb16-ecce-4cce-801c-a9d100fc4504", "purchaseId": 3807969, "order": { "currency": "sek", "totalFeeExcludingTax": 15.39, "totalFeeIncludingTax": 19.24, "totalPriceExcludingTax": 427.14, "totalPriceIncludingTax": 540, "totalTaxAmount": 112.86, "totalCreditedAmount": 0, "items": [ { "itemId": "0b2a5f5f-250a-42b2-84c1-a9d1010d2a40", "discountRate": 0, "ean": null, "imageUri": null, "name": "TestItem3", "quantity": 2, "reference": "R103", "taxRate": 0, "totalPriceExcludingTax": 40, "totalPriceIncludingTax": 40, "totalTaxAmount": 0, "creditedAmount": 0, "type": "physical", "unitPrice": 20, "uri": null }, { "itemId": "6f5f3005-0f6f-4f55-9589-a9d1010d2a40", "discountRate": 0, "ean": null, "imageUri": null, "name": "TestFee", "quantity": 1, "reference": "F001", "taxRate": 0.25, "totalPriceExcludingTax": 80, "totalPriceIncludingTax": 100, "totalTaxAmount": 20, "creditedAmount": 0, "type": "fee", "unitPrice": 100, "uri": null }, { "itemId": "14585100-c3e8-46db-9bf1-a9d1010d2a40", "discountRate": 0, "ean": null, "imageUri": null, "name": "TestItem2", "quantity": 3, "reference": "R102", "taxRate": 0.4, "totalPriceExcludingTax": 107.14, "totalPriceIncludingTax": 150, "totalTaxAmount": 42.86, "creditedAmount": 0, "type": "physical", "unitPrice": 50, "uri": null }, { "itemId": "995f5373-4914-44c4-b038-a9d1010d2a40", "discountRate": 0.5, "ean": null, "imageUri": null, "name": "TestItem1", "quantity": 1, "reference": "R101", "taxRate": 0.25, "totalPriceExcludingTax": 200, "totalPriceIncludingTax": 250, "totalTaxAmount": 50, "creditedAmount": 0, "type": "physical", "unitPrice": 500, "uri": null } ] }, "description": null, "notificationUri": null, "status": "readyToShip", "links": [ { "href": "https://test-api.payson.se/2.0/RecurringPayments/0fb03b40-8a1b-4c4a-9c4b-a9d1010d2a3f", "rel": "self" } ] }, { "id": "607bc67c-8104-43d9-b2b2-a9d101116f9d", "created": "2019-01-10T17:35:33", "subscriptionId": "3ad8eb16-ecce-4cce-801c-a9d100fc4504", "purchaseId": 3807970, "order": { "currency": "sek", "totalFeeExcludingTax": 15.39, "totalFeeIncludingTax": 19.24, "totalPriceExcludingTax": 427.14, "totalPriceIncludingTax": 540, "totalTaxAmount": 112.86, "totalCreditedAmount": 0, "items": [ { "itemId": "5febd768-b57c-4708-9901-a9d101116f9e", "discountRate": 0, "ean": null, "imageUri": null, "name": "TestItem2", "quantity": 3, "reference": "R102", "taxRate": 0.4, "totalPriceExcludingTax": 107.14, "totalPriceIncludingTax": 150, "totalTaxAmount": 42.86, "creditedAmount": 0, "type": "physical", "unitPrice": 50, "uri": null }, { "itemId": "31b0f4cf-c589-452b-aadf-a9d101116f9e", "discountRate": 0, "ean": null, "imageUri": null, "name": "TestFee", "quantity": 1, "reference": "F001", "taxRate": 0.25, "totalPriceExcludingTax": 80, "totalPriceIncludingTax": 100, "totalTaxAmount": 20, "creditedAmount": 0, "type": "fee", "unitPrice": 100, "uri": null }, { "itemId": "de66f27e-3dfc-4f43-ae0e-a9d101116f9e", "discountRate": 0, "ean": null, "imageUri": null, "name": "TestItem3", "quantity": 2, "reference": "R103", "taxRate": 0, "totalPriceExcludingTax": 40, "totalPriceIncludingTax": 40, "totalTaxAmount": 0, "creditedAmount": 0, "type": "physical", "unitPrice": 20, "uri": null }, { "itemId": "ee866b30-e024-49e2-b209-a9d101116f9e", "discountRate": 0.5, "ean": null, "imageUri": null, "name": "TestItem1", "quantity": 1, "reference": "R101", "taxRate": 0.25, "totalPriceExcludingTax": 200, "totalPriceIncludingTax": 250, "totalTaxAmount": 50, "creditedAmount": 0, "type": "physical", "unitPrice": 500, "uri": null } ] }, "description": null, "notificationUri": null, "status": "readyToShip", "links": [ { "href": "https://test-api.payson.se/2.0/RecurringPayments/607bc67c-8104-43d9-b2b2-a9d101116f9d", "rel": "self" } ] } ] }
R = Required, O = Optional
Parameter | Type | Description | |
---|---|---|---|
subscription | |||
id | UUID | Unique identifier of the subscription. | Read only |
snippet | String (HTML) | HTML-snippet. | Read only |
status | String | Status of the subscription. | O |
merchant | Merchant resource. | R | |
customer | Customer resource. | O | |
agreement | Agreement resource. | R | |
gui | Gui resource. | O | |
history | History resource. | Read only | |
merchant | |||
checkoutUri | URI | URI to the merchants subscription checkout page. An optional querystring parameter with tag “{id}” may be added, where “{id}” will be replaced with the subscription id. The name of the parameter can be whatever you choose. For example: https://www.mystore.com/notification?parametername={id} |
R |
confirmationUri | URI | URI to the merchants confirmation page. An optional querystring parameter with tag “{id}” may be added, where “{id}” will be replaced with the subscription id. The name of the parameter can be whatever you choose. For example: https://www.mystore.com/notification?parametername={id} |
R |
notificationUri | URI | Notification URI which receives status updates. An optional querystring parameter with tag “{id}” may be added, where “{id}” will be replaced with the subscription id. The name of the parameter can be whatever you choose. For example: https://www.mystore.com/notification?parametername={id} |
R |
termsUri | URI | URI to the merchants terms page. | R |
validationUri | URI | Validation URI which is called to verify an order before it can be paid. Can for example be used to make sure all products are still in stock before payment is done. Make sure the URI is publicly accessible. An optional querystring parameter with tag “{id}” may be added, where “{id}” will be replaced with the subscription id. The name of the parameter can be whatever you choose. For example: https://www.mystore.com/notification?parametername={id} |
O |
integrationInfo | String (max 100) | Information about the integration. | O |
partnerId | String (max 100) | Partners unique identifier. Only applicable for certain merchants. If you haven’t received a partnerId from Payson then you don’t use this parameter | O |
reference | String (max 100) | Merchants own reference of the subscription. Can for example be used for your order id. | O |
customer | |||
city | String (max 100) | O | |
countryCode | String (max 2) | O | |
identityNumber | String (max 20) | O | |
String (max 100) | O | ||
firstName | String (max 100) | O | |
lastName | String (max 100) | O | |
phone | String (max 20) | O | |
postalCode | String (max 20) | O | |
street | String (max 100) | O | |
type | String | Can be ‘person’ or ‘business’. | O (default ‘person’) |
agreement | |||
currency | String (currency) | Can be ‘sek’ or ‘eur’. | R |
gui | |||
colorScheme | String | Color scheme of the subscription snippet. Can be ‘Gray’ or ‘White’. | O (default ‘white’) |
locale | String (locale) | Language of the subscription snippet. Can be ‘sv’, ‘en’, ‘fi’, ‘no’, ‘da’, ‘es’ or ‘de’. | O (default ‘en’) |
requestPhone | Bool | Used to require the user to fill in his phone number. | O (default false) |
phoneOptional | Bool | Used to ask the user to fill in his phone number, but not strict required. | O (default false) |
countries | Array | List of countries a customer can choose in the subscription snippet. Case sensitive, e.g use: [“SE”, “GB”, “DK”] |
O (default null will list all countries) |
verification | String | Used to enable BankID verification. Can be ‘none’ or ‘bankid’. | O (default ‘none’) |
history | |||
created | Date and time (ISO 8601) | Time the status was set to Created. | Read only |
awaitingSubscription | Date and time (ISO 8601) | Time the status was set to AwaitingSubscription. | Read only |
customerSubscribed | Date and time (ISO 8601) | Time the status was set to CustomerSubscribed. | Read only |
customerUnsubscribed | Date and time (ISO 8601) | Time the status was set to CustomerUnsubscribed. | Read only |
canceled | Date and time (ISO 8601) | Time the status was set to Canceled. | Read only |
expired | Date and time (ISO 8601) | Time the status was set to Expired. | Read only |
R = Required, O = Optional
Parameter | Type | Description | |
---|---|---|---|
payment | |||
id | UUID | Unique identifier of the payment. | Read only |
subscriptionId | UUID | Unique identifier of the subscription. | R |
purchaseId | Null/int | Unique identifier of Payson payment. Null until status changes to readyToShip. | Read only |
notificationUri | URI | Notification URI which receives status updates. An optional querystring parameter with tag “{id}” may be added, where “{id}” will be replaced with the payment id. The name of the parameter can be whatever you choose. For example: https://www.mystore.com/notification?parametername={id} |
R |
expirationDate | Date and time (ISO 8601) | Expiration time of the payment. | R |
description | String | Used to describe the payment. | O |
status | String | Status of the payment. | O |
order | Order resource. | R | |
history | History resource. | Read only | |
order | |||
currency | String (currency) | Can be ‘sek’ or ‘eur’. | R |
items | Array (order items) | Order items. | R |
totalPriceExcludingTax | Decimal number (2 decimals) | Total price of the order excluding taxes. | Read only |
totalPriceIncludingTax | Decimal number (2 decimals) | Total price of the order including taxes. | Read only |
totalFeeExcludingTax | Decimal number (2 decimals) | Total fee of the order excluding taxes. | Read only |
totalFeeIncludingTax | Decimal number (2 decimals) | Total fee of the order including taxes. | Read only |
totalTaxAmount | Decimal number (2 decimals) | Total taxes of the order. | Read only |
totalCreditedAmount | Decimal number (2 decimals) | Total credited amount of the order. | Read only |
items | |||
discountRate | Decimal number (0.00-1.00) | Discount rate of the article. | O |
creditedAmount | Decimal number (2 decimals) | Credited amount. Can only be set after an order has been shipped. | (O) |
ean | String (8-18) | European Article Number. | O |
imageUri | URI | A URI to an image of the article | O |
itemId | UUID | Unique number used to identify the item. Will be assigned by Payson during the creation of an order. | O |
name | String (max 200) | Name of the article. | R |
quantity | Integer | Quantity of the article. | R |
reference | String (max 100) | Article reference, usually the article number. | R |
taxRate | Decimal number (0.00-1.00) | Tax rate of the article. | O |
totalPriceExcludingTax | Decimal number (2 decimals) | Total price of the article excluding tax. | Read only |
totalPriceIncludingTax | Decimal number (2 decimals) | Total price of the article including tax. | Read only |
totalTaxAmount | Decimal number (2 decimals) | Total tax of the article. | Read only |
type | String | Type of article. Can ‘physical’, ‘discount’, ‘fee’ or ‘service’. | O (default ‘physical’) |
unitPrice | Decimal number (2 decimals) | Unit price of the article including tax. 2 decimals, make sure all tax rounding is done before sending to Payson. | R |
uri | URI | URI to a page with information about the item (product page). | O |
history | |||
created | Date and time (ISO 8601) | Time the status was set to Created. | Read only |
readyToShip | Date and time (ISO 8601) | Time the status was set to ReadyToShip. | Read only |
shipped | Date and time (ISO 8601) | Time the status was set to Shipped. | Read only |
paidToAccount | Date and time (ISO 8601) | Time the status was set to PaidToAccount. | Read only |
denied | Date and time (ISO 8601) | Time the status was set to Denied. | Read only |
After a subscription or payment has had its status changed to a status where the merchant may need to act, a notification will be sent. The notification is a POST call to the notificationUri specified with the id as a querystring parameter.
Example
https://www.myexamplestore.nu/notification.php/?subscription=ccf49366-ea2d-410f-8bbf-a97b00912a37
https://www.myexamplestore.nu/notification.php/?payment=ccf49366-ea2d-410f-8bbf-a97b00912a37
Make sure the notificationUri is publicly accessible for notifications to work.
The POST to notificationUri expect a 200 OK in response and will keep trying for up to 24 hours if the response is anything else.
Subscriptions – Notification is sent when | The subscription will have status |
---|---|
The subscription is complete and the merchant can now create payments. | customerSubscribed |
The subscription is canceled. | customerUnSubscribed |
Payments – Notification is sent when | The payment will have status |
---|---|
The payment is complete and the order should be shipped. | readyToShip |
The payment has been marked as shipped. | shipped |
Money has been paid out to the merchant´s PaysonAccount. | paidToAccount |
The payment has been denied. | denied |
The payment was canceled. | canceled |
The payment has been fully credited. | paidToAccount* |
The payment has been partially credited. | shipped* |
*Check totalCreditedAmount to determine if the payment has been credited.