Managing orders
Settle, cancel, refund, and update applications after checkout.
After checkout, you manage the application with its token. All of these calls need an access token.
Settle
Settle an application when the order ships. This tells PayTomorrow to fund you and starts the customer's payment schedule.
curl -X POST "https://api.paytomorrow.com/api/ecommerce/application/$TOKEN/settle" \
-H "Authorization: Bearer $ACCESS_TOKEN"- Settle only applications in status
S(Ready to Settle). - Settle after you ship, not at checkout. Settling starts the customer's billing.
- A
completedpostback follows once funding starts. Add?postback=falseif you don't want it.
Cancel
Cancel an application you won't fulfill, for example if an item is out of stock. Only unfunded applications can be cancelled.
curl -X POST "https://api.paytomorrow.com/api/ecommerce/application/$TOKEN/cancel" \
-H "Authorization: Bearer $ACCESS_TOKEN"Add ?postback=false if your system already knows about the cancellation and you don't want the cancelled postback.
Refund
Refund the full amount of a settled or funded application.
curl -X POST "https://api.paytomorrow.com/api/ecommerce/application/$TOKEN/refund" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "reason": "Customer returned the item" }'Partial refund
Refund part of an order, for example when the customer returns one of two items. Send the cart as it should look after the refund.
curl -X POST "https://api.paytomorrow.com/api/ecommerce/application/$TOKEN/partial/refund" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"loanAmount": 749.99,
"shipping": 0,
"taxes": 50,
"items": [
{ "description": "55-inch 4K Smart TV", "quantity": 1, "price": 699.99 }
]
}'A partial refund returns a new token
PayTomorrow creates a new application for the reduced cart. Replace the token stored on your order with the token in the response. Future calls and postbacks use the new one.
The response status is the new application's status code, not ok. For a funded order that's C. If the new loanAmount is higher than the current one, it's B (Waiting for Consumer): PayTomorrow emails the customer updated documents, and the application moves to S or C once they sign. Hold the order until then.
Update the order ID
If your platform assigns the final order number after the customer finishes, update it so postbacks and reports use the right ID.
curl -X POST "https://api.paytomorrow.com/api/ecommerce/application/$TOKEN/update/order/id" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "id": "100045-A" }'