The Retrieve Subscription Switch Charge Amount request enables you to retrieve the amount that would be charged to a shopper if you changed the subscription to a different plan or to a different quantity or both. If the switch would result in a negative balance, then the value
parameter shows 0.00.
This request does not make any changes to the subscription; it just retrieves the new price. To make the switch, use the Update Subscription request.
Example
Your shopper's subscription (ID 98989) is currently associated with the Silver Plan, at a cost of $10 per month. It is halfway through the month, and you would like to find out how much the subscriber would be charged if you switched their subscription to the Gold Plan (ID 111111, cost of $20 per month) today. To do this, you would send a GET request in this format:
services/2/recurring/subscriptions/98989/switch-charge-amount?newplanid=111111
Because the month is half over, half of the amount that was charged for the Silver Plan is remaining (i.e. $5). That amount would be applied to the charge for the Gold Plan, so the value returned is 15.00.
Send a test request
Go to API Explorer to send a test request to our sandbox environment and receive a response in real time.
Request Content
Enter the parameters below into the request URL. For example:
services/2/recurring/subscriptions/98989/switch-charge-amount?newplanid=3068673
To determine what the price would be if the quantity is changed, add the newquantity
parameter. For example:
services/2/recurring/subscriptions/98989/switch-charge-amount?newplanid=98989&newquantity=2
Query Parameters
Parameter | Description | Example |
---|---|---|
newplanid | The plan ID for which you want to retrieve the cost information. Required | newplanid=111111 |
newquantity | The number of subscriptions for which you want to retrieve the combined cost. Optional | newquantity=2 |
Note
You must include
newplanid
with thenewquantity
parameter. If you want to see the cost of the new quantity on the current plan, enter the currentplanid
. If you want to see the results if you change the plan and the quantity, enter the new values for both.
Response Details
If successful, the response HTTP status code is 200 OK.
The response contains the retrieved price object.
Note
If you included the
newquantity
parameter in the Request, the response price is the price of the subscription multiplied by the new quantity.
Examples
Request Example
curl -v -X GET https://sandbox.bluesnap.com/services/2/recurring/subscriptions/98989/switch-charge-amount?newplanid=111111 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
curl -v -X GET https://sandbox.bluesnap.com/services/2/recurring/subscriptions/98989/switch-charge-amount?newplanid=111111&newquantity=2 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
Response Example
{
"currency": "USD",
"value": 15
}
API Explorer
To test out a basic API request, click the "Try It!" button in the right-hand column to test using the default, pre-populated sample values. To test with your own values, edit the parameter fields below. You'll see them populate in the right-hand column and you can click the "Try It!" button to submit your test request and see a response.