Payment
Payments are applied to invoices. Invoices can have any number of payments attached, and each payment can be of a different type and amount.
The payment model
The payment model contains identifying information about the payment.
Properties
- Name
id- Type
- string
- Description
Unique identifier for the payment.
- Name
invoice_id- Type
- string
- Description
Identifier for the invoice the payment is applied to.
- Name
method- Type
- string
- Description
Identifier for the payment method used.
- Name
amount- Type
- float
- Description
The amount of the payment.
- Name
data- Type
- object
- Description
An object containing the gateway response data..
- Name
date_created- Type
- string
- Description
Timestamp of when the payment was posted.
- Name
status- Type
- string
- Description
A string enum for indicating the current status of the payment.
Create a payment
This endpoint allows you to apply a payment to an invoice. A payment must include an invoice ID, method, and amount.
Required attributes
- Name
invoice_id- Type
- string
- Description
The ID of the invoice the payment is applied to.
- Name
method- Type
- string
- Description
The payment method used.
- Name
amount- Type
- float
- Description
The amount of the payment.
Request
curl -G https://api.spoonity.com/payments \
-H "Authorization: Bearer {token}" \
-d invoice_id="invo_yrhst36ruqh41h31" \
-d method="CASH" \
-d amount=5.00
Response
{
"id": "paym_32f9395aa82770bb",
"invoice_id": "invo_yrhst36ruqh41h31",
"method": "CASH",
"data": {},
"amount": 5.00,
"date_created": "2021-09-29T12:22:12.000Z",
"status": "COMPLETE"
}
Void a payment
This endpoint allows you to cancel a payment from an invoice.
Path parameters
- Name
id- Type
- string
- Description
The payment ID.
Request
curl -G https://api.spoonity.com/payments/:id \
--request DELETE \
-H "Authorization: Bearer {token}"
Response
{}