post
https://sandbox.bluesnap.com/services/2/surcharge/calculate-prorated
The Calculate Prorated Surcharge request determines the prorated surcharge amount of a transaction. After you provide the partial amount to capture/refund and the surcharge token in the request, the API will return the prorated surcharge.
This call is optional for partial captures/refunds, but highly recommended. If you don't call this API, BlueSnap will split the total refund amount between the invoice and surcharge.
For more information about working with surcharges, see the Surcharges tutorial.
Capture Example
| Scenario | Invoice Captured | Surcharge Captured | Total Captured |
|---|---|---|---|
| $40 invoice with Prorate API | $40.00 | $1.20 | $41.20 |
| $40 invoice without Prorate API | $38.83 | $1.17 | $40.00 |
Refund Example
| Scenario | Invoice Refunded | Surcharge Refunded | Total Refunded |
|---|---|---|---|
| Full Refund | $100.00 | $3.00 | $103.00 |
| $40 refund without Prorate API | $38.83 | $1.17 | $40.00 |
| $40 refund with Prorate API | $40.00 | $1.20 | $41.20 |
Request Content
Send a surchargeCalculation object, with the following:
| Property | Type | Required |
|---|---|---|
amount | string | required |
surchargeInfo | container | required; (see surchargeInfo) |
Response Details
If successful, the response HTTP status code is 200 OK.
The response contains the surchargeCalculation object.
Examples
Request Examples
curl -v -X POST https://sandbox.bluesnap.com/services/2/surcharge/calculate-prorated \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
"amount": "40.00",
"surchargeInfo": {
"surchargeToken": "eyJhbGciOiJIUzUxMiJ9**********"
}
}'Response Examples
{
"amount": "20.00",
"currency": "USD",
"surchargeInfo": {
"surchargeReference": 103,
"surchargeAmount": 1.20,
"surchargeRate": 2.40,
"description": "Surcharge calculated successfully",
"surchargeToken": "eyJhbGciOiJIUzUxMiJ9**********"
}
}