The shopping cart is where the information on the products chosen by the customer while browsing a store is gathered. This data may include item prices, shipping value, payment, and delivery methods, among others.
This guide will describe how to obtain information about the number of installments and their respective amounts from an existing payment method in the shopping cart.
Before starting the search for information about installments, make sure that there is already payment information (
paymentData
) assigned to the chosen cart (orderFormId
).
Getting shopping cart information
The first step is to get the orderFormId
of the shopping cart information that you want to obtain information about the amount of installments. For more information, access the Get cart information by ID guide.
Accessing cart installments information
With the orderFormId
information available, you must use the Cart installments endpoint to send the following information through the URL:
- Path Param:
orderFormId
value. - Query Param:
paymentSystem
. Payment method Id in which the installments information will be consulted.
See a URL example below:
https://{accountname}.{environment.com.br}/api/checkout/pub/orderForm/9420cbb7ebc34ca68a86621428816c5a?paymentSystem=2
After sending the request, the endpoint will return the response body containing the installments information, as shown in the example below:
_28..._28{_28 "paymentSystem": "2",_28 "bin": null,_28 "paymentName": null,_28 "paymentGroupName": null,_28 "value": 6940,_28 "installments": [_28 {_28 "count": 1,_28 "hasInterestRate": false,_28 "interestRate": 0,_28 "value": 6940,_28 "total": 6940,_28 "sellerMerchantInstallments": [_28 {_28 "id": "COSMETICS2",_28 "count": 1,_28 "hasInterestRate": false,_28 "interestRate": 0,_28 "value": 6940,_28 "total": 6940_28 }_28 ]_28 }_28 ]_28}_28...
️ For more information about the meaning of each of the fields available in the shopping cart, access the orderForm overview.
Error codes
The following errors may appear as a message in the response body.
400 - Bad Request
- Message error example (code ORD002):
"Invalid order form"
. TheorderFormId
information is not valid.
_10{_10 "fields": {},_10 "error": {_10 "code": "ORD002",_10 "message": "Invalid order form",_10 "exception": null_10 },_10 "operationId": "d6a5b535-68b4-49f7-a783-93762974554b"_10}
- Message error example (code CHK0152):
"Orderform does not have installment options"
. This shopping cart does not have any payment information (paymentData
).
_10{_10 "fields": {},_10 "error": {_10 "code": "CHK0152",_10 "message": "Orderform does not have installment options",_10 "exception": null_10 },_10 "operationId": "6d8408b4-3adf-4fc7-b708-8d322b3e021f"_10}
404 - Not Found
- Message error example:
"The requested URL was not found on the server"
. Check that the URL data is correct.
_10<body>_10 <h1>404 Not Found</h1>_10 <p>The requested URL was not found on this server.</p>_10</body>