- Create purchase
The amount of the purchase. The amount can be updated only if the purchase status is pending or authorized. The amount and status of a purchase may be changed on the same call.
Peach id, Peach public id (CD-...), or lender external id (ext-...) of the card used for this purchase. Resolved against cards belonging to this line of credit. If the card cannot be resolved (unknown id or wrong loan), the purchase is still created and validation.cardIdMissing is set to true in the response.
In responses from read endpoints, this field is always returned as the Peach public id (CD-...) or null.
The external unique identifier of the purchase.
Purchase migration related details. This object should be used for lines that are migrated from another system to Peach.
Peach's unique or lender's external identifier. Typically used for purchases of type refund which allows the lender to reference the original purchase being refunded. For authorizations, please see authorizationPurchaseId attribute.
The date of a purchase. This attribute can be passed only during the line of credit migration process. Don't use this attribute after the migration process was successfully completed.
- The value must be before or equal to today, and cannot be greater than the "migration at date" (aka the actual date on which you run the migration.)
- If you pass
purchaseDateyou cannot passauthorizedAtand/oreffectiveAt. - If
purchaseDateis passed, the system will setauthorizedAtandeffectiveAttopurchaseDateat 6:00 AM in the product timezone. - If you
purchaseDateis not passed, you must pass bothauthorizedAtandeffectiveAt.authorizedAtcannot be greater thaneffectiveAt.
For non-migrated purchases:
- The value is equal to the date part of the
authorizedAtconverted to the product timezone (e.g. Eastern or Pacific). IfauthorizedAtis null, this value is equal to the date part of the purchase'screatedAtconverted to the product timezone.
The purchaseDate is returned in Get endpoints for both migrated and non-migrated purchases.
The status of the purchase.
authorized- the purchase is authorized and not yetsettled. Authorized purchases are included inutilizationAmount,openToBuyandavailableCreditAmountcalculations; however, authorizations are not written to the ledger and are not included in total outstanding loan balances.settled- the purchase was settled.pending- the purchase is pending.pendingpurchases increases the draw balance similar tosettled. Pending status is used mainly for visuals and normally shown in Borrower Portal and on statements.canceled- the purchase was canceled.canceledpurchases reduce the draw balance. A new purchase cannot be created incanceledstatus.declined- the purchase was declined.declinedpurchases reduce the draw balance if the status changes frompendingtodeclined. A new purchase can be created indeclinedstatus for record purposes (it will not impact the draw balance).disputed- The purchase was disputed for full or partial amount.disputedstatus is a terminal state and once set cannot be changed to another status. This status can not be set manually. Submitting a purchase dispute will set the purchase's status todisputed.
The following status transitions are allowed:
authorized->pendingauthorized->settledauthorized->canceledauthorized->declinedpending->settledpending->canceledpending->declineddeclined->authorizedsettled->canceledsettled->disputed(only by calling "Create purchase dispute")
regular- a regular purchase made by the borrower. Increases draw's balance.refund- a refund of the purchase made in the past. Decreases draw's balance.cashBack- cash back given to the borrower by the issuing institution.
The effective timestamp when the purchase was applied in the ledger. This attribute can be passed only during the line of credit migration process. Don't use this attribute after the migration process was successfully completed.
effectiveAt is equal to the timestamp when the purchase is set to pending or settled status, whichever comes first. The timezone is UTC for this timestamp and the format is ISO. For example, in order to set a purchase effectiveAt to July 28th 2022, 10:44 am PDT, send 2022-07-28T17:44:00Z.
- oauth2
- bearerAuth
- apiKeyHeader
curl -i -X POST \
'https://sandboxapi.peach.finance/api/people/{personId}/loans/{loanId}/draws/{drawId}/purchases?force=false&forceOverLimit=false&forceIfClosed=false&sync=false' \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"amount": 0,
"authorizationPurchaseId": "string",
"cardId": "string",
"declineReason": {
"mainExternalReasonCode": "string",
"mainScriptForRep": "string",
"mainText": "string"
},
"externalId": "string",
"metadata": {},
"migration": {
"originalDrawId": "string"
},
"originalPurchaseId": "string",
"purchaseDate": "2019-08-24",
"purchaseDetails": {
"categoryId": "string",
"conversionRate": 0.1,
"description": "Purchase",
"externalCardId": "string",
"merchantCategoryCode": "string",
"merchantCity": "string",
"merchantCountry": "string",
"merchantId": "string",
"merchantName": "string",
"merchantState": "string",
"metadata": {},
"originalCurrencyAmount": 0.1,
"originalCurrencyCode": "string",
"pointOfSaleType": "online"
},
"status": "settled",
"type": "regular",
"authorizedAt": "2019-08-24T14:15:22Z",
"effectiveAt": "2019-08-24T14:15:22Z"
}'{ "message": "string", "status": 0, "data": { "amount": 0, "authorizationPurchaseId": "string", "cardId": "string", "declineReason": { … }, "displayId": "string", "drawId": "string", "eligibleDisputeAmount": 0.1, "externalId": "string", "id": "string", "lineOfCreditId": "string", "metadata": {}, "migration": { … }, "originalAmount": 0.1, "purchaseDate": "2019-08-24", "purchaseDetails": { … }, "status": "settled", "timestamps": { … }, "type": "regular", "refundDetails": { … } }, "validation": { "cardIdMissing": true } }