Record a payment on a lead. Use this when a payment was taken outside the software (for example by your own website or point of sale) and you want it to show on the lead.
| Method | URL | API key permission | Package |
|---|---|---|---|
| POST | https://rental.software/api6/handle_payment | Leads: Full Access | WP/API |
Note: this call records a payment. It does not charge a card.
Request
All of the parameters below are optional except leadid and payamt. This is not a complete list.
POST /api6/handle_payment/?apiKey=YOUR_API_KEY {
leadid: 520247
paystat: Completed
payamt: 115.34
type: credit
processor: square
time: 1588276908
orderid: 23XVB67
reasoncode: Approved
surcharge: 3.58
tip: 25.00
}| Parameter | Description |
|---|---|
| leadid | Required. The lead the payment is for. First create or query a lead record to get this ID |
| payamt | Required. The amount paid |
| paystat | Completed or Denied. Defaults to Completed. The lead's paid amount and balance are only updated for a Completed payment |
| type | The payment type. These are defined by the user, so use the payment types set up in your account. Defaults to credit |
| processor | Informational. Names we use: Authorize, Beanstream, check, Moneris, novera, openedge, openedge_mobile, PayJunction, PayPal IPN, square |
| time | Time of the transaction as a Unix timestamp. Defaults to now |
| manual | Send 1 if you want to give the date as text instead of a Unix timestamp. Then put the date in time, in the date format of your account (for example 4/29/2020). The current time of day is used |
| orderid | A reference number to the transaction, like a check number |
| reasoncode | Additional transaction data, usually explaining the success or failure of the transaction from the processor. For example Failed due to incorrect name |
| cardholder | Name on the card |
| surcharge | Dollar amount of the card surcharge included in payamt. A surcharge fee is added to the lead and taxed. The fee is calculated from the surcharge rate set in your account |
| tip | Dollar amount of the tip included in payamt. It is added to the lead as a fee named Tip and is not taxed |
Saving a payment can result in alterations to a lead, especially in the case of a surcharge or tip.
Example
curl -X POST "https://rental.software/api6/handle_payment" \ -d "apiKey=YOUR_API_KEY" \ -d "leadid=520247" \ -d "payamt=115.34" \ -d "paystat=Completed" \ -d "type=check" \ -d "processor=check" \ -d "orderid=1042"
Response
A successful call returns HTTP 200 with the saved payment. Keep the id if you need to refer to the payment later.
{
"id": "884213",
"paystat": "Completed",
"payamt": "115.34",
"processor": "check",
"type": "check",
"itemnum": "520247",
"time": "1588276908",
"currency": "USD",
"txnid": "1042",
"reasoncode": "",
"cardholder": "",
"request_time": 1760000000
}The response can include a few extra keys not listed here. Your code should ignore keys it does not use.
Good to Know
- The API does not check for duplicate payments. If you send the same payment twice, it is recorded twice. Make sure your integration does not retry a payment that already went through.
- To see which payment types your account uses, call paymenttypes_list. See API - Lookup Lists.
Errors
| Status | Message | What to do |
|---|---|---|
| 405 | Only accepts POST requests | Use POST |
See API - Errors and Rate Limits for errors that apply to every call.