Partially pay an invoice
- Step 1: Create a POST request
- Step 2: Configure authorization
- Step 3: Configure headers
- Step 4: Send your request
This example shows how to partially pay an invoice. To do so, we use the s2cor package exposed by Financials as a resource via the APEX REST API.
To try out the steps in this section, install Postman and open the Postman collection we have prepared for you. In the collection, open the Partially pay an invoice request and replace variables with actual values.
Download Postman Open Postman Collection
Step 1: Create a POST request
Configure your application to send the following request:
POST https://{your_Salesforce_domain}/services/apexrest/s2cor/api/1.0/transaction?recordIds=["a1x1N000002tFaOQAU"]&selectedType=Partial&amountToCredit=250.00&productId=01t1N00000EqLDzQAN&documentDate=2018-02-20&totalAmount=1000.00&tagsMap=[{"Id":"a141N000004SC6vQAG"}]
where
- {your_Salesforce_domain} is your Salesforce sandbox or production domain, for example, my-domain-1234.cs89.my.salesforce.com.
- a1x1N000002tFaOQAU is the ID of the invoice you want to pay.
- 01t1N00000EqLDzQAN is a product ID from line item.
- 250.00 is the amount to credit towards the invoice.
- 2018-02-20 is the date of the invoice.
- 1000.00 is the outstanding amount.
- a141N000004SC6vQAG is the invoice number tag.
Step 2: Configure authorization
Make sure your request uses OAuth 2.0. Authorization data must be included in the request URL.
Step 3: Configure headers
Configure the request headers to include the following key-value pairs:
Key | Value |
---|---|
Authorization | Bearer {access_token} Example: Bearer 00D0N000000h6Yq!AR0AQObORnk9lCldrMydk1Y3cuyqpscqcU.T1xvoM1uWkWrr8MLu2ehJLKp7Mz3Qeu.eQGI13qlH_HfGEEMxV_J8FdI1TwdR |
Content-Type | application/json |
Step 4: Send your request
Send your request to partially pay the invoice.