Transfer subscription
/subscription/transfer_subscription
Target audience: Developers
Transfer subscription¶
Introduction¶
This endpoint allows you to transfer a subscription from one account to another. The subscription, along with its order and payment profile history, will be transferred to the target account.
Important
This operation re-writes the history of the subscription, order, and any associated payment profiles. While the subscription can be transferred back to its original account, the action itself cannot be undone. Use with extreme caution.
URI¶
| Environment | URI |
|---|---|
| Stage | https://payway-api.stage.adeprimo.se/external/api/v1/subscription/transfer_subscription |
| Production | https://backend.worldoftulo.com/external/api/v1/subscription/transfer_subscription |
Requirements¶
| Identity | Scope |
|---|---|
| No | /external/subscription/w |
The target account must:
- exist in Payway
- be identified by a valid email address
The subscription must:
- exist on the source account
- belong to the same organisation
- not be paid via Adyen
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
| source_account_id | String | Required | The id of the account that currently owns the subscription. Size range: ..24 Format: 24-character hexadecimal |
| subscription_id | String | Required | The id of the subscription (user_product) to transfer. Size range: ..24 Format: 24-character hexadecimal |
| target_account_email | String | Required | The email address of the account to transfer the subscription to. |
Curl Example¶
curl --request PUT \
--url https://payway-api.stage.adeprimo.se/external/api/v1/subscription/transfer_subscription \
--header 'accept: application/json' \
--header 'authorization: Bearer <token>' \
--header 'content-type: application/json' \
--data '{
"source_account_id": "585a4768edce2c5e6f000001",
"subscription_id": "585a4768edce2c5e6f000002",
"target_account_email": "newowner@example.com"
}'
Response¶
| Field | Description |
|---|---|
| id | The id of the transferred subscription |
Example Response¶
HTTP 200
{
"id": "585a4768edce2c5e6f000002"
}
Errors¶
Source account does not exist¶
HTTP 404 Not Found
{
"code": "does_not_exist",
"field": "unspecified_field",
"message": "585a4768edce2c5e6f000001 does not exist"
}
Subscription does not exist or does not belong to source account¶
HTTP 404 Not Found
{
"code": "does_not_exist",
"field": "unspecified_field",
"message": "Subscription not found"
}
Target account does not exist¶
HTTP 404 Not Found
{
"code": "account_not_found",
"field": "target_account_email",
"message": "No account found with email: newowner@example.com"
}
Invalid email format¶
HTTP 400 Bad Request
{
"code": "invalid_parameter",
"field": "target_account_email",
"message": "Invalid email format"
}
HTTP 500 Internal Server Error¶
| Name | Type | Description |
|---|---|---|
| internal_server_error | Object | Something unexpected happened server side |