Payments

A payment represents a charge to your customer's credit or debit card.

When you want to pay a Payment before, you must create a Source and attach it to the Payment through the authorize resource. If the Source gateway belongs to a payment gateway with single_use usage, it should be paid through the pay resource, while if it belongs to a payment gateway with reusable usage, it will immediately try to charge the credit or debit card of the customer.

Payment object

Attributes

id string

Unique identifier of the object.

date string

A positive number representing the amount to charge.

amount number

A date equal to or greater than today in yyyy-mm-dd format.

currency string

Three-letter ISO code for the currency of the payment.

description string

A description for payment with a max length of 256 characters.

source object

payment_date timestamp

Time at which the Payment was payed in format yyyy-mm-dd hh:mm:ss

customer object

ID of the Customer this payment belongs to, of one exists.

invoice object

status string

The status of the Source, one of requires_payment_method, processing, succeeded or canceled. The default status when the Payment is created is requires_payment_method.

metadata object

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. All keys can be unset by posting an empty value to metadata.

created timestamp

Time at which the object was created in format yyyy-mm-dd hh:mm:ss

updated timestamp

Time at which the object was updated in format yyyy-mm-dd hh:mm:ss

Create a payment

POST https://api.piriod.com/payments/

Creates a new Payment object.

Request Body

Name
Type
Description

amount

number

A positive number representing the amount to charge.

date

string

A date equal to or greater than today in yyyy-mm-dd format.

description

string

A description for payment with a max length of 256 characters.

currency

string

Three-letter ISO code for the currency of the payment.

customer

string

ID of the Customer this payment belongs to, of one exists.

invoice

string

ID of the Invoice this payment belongs to, of one exists.

{
    "id": "pay_ck6HZUxJR598PZf0uZ",
    "date": "2020-08-28",
    "amount": 12.5,
    "description": "Payment example via API",
    "status": "requires_payment_method",
    "payment_date": null,
    "invoice": null,
    "customer": null,
    "currency": "USD",
    "source": null
    "metadata": {},
    "created": "2020-04-10T13:48:55.259886-04:00",
    "updated": "2020-04-10T13:48:55.259903-04:00"
}

Retrieve a payment

GET https://api.piriod.com/payments/{{id}}/

Retrieves a Payment object. Send via path parameters the unique Payment ID from a payment creation request and Piriod will return the Payment object information.

Path Parameters

Name
Type
Description

id

string

ID of the Payment object.

{
    "id": "pay_PzoIDAkGXidKVfjjf8",
    "date": "2020-03-28",
    "amount": 12.0,
    "description": "Payment example via API",
    "status": "requires_payment_method",
    "payment_date": null,
    "invoice": null,
    "customer": null,
    "currency": "USD",
    "source": {
        "id": "sou_O9Bzlb6OAf09lB8xC1",
        "amount": 12.0,
        "description": null,
        "return_url": null,
        "status": "chargeable",
        "metadata": {},
        "created": "2020-03-26T12:54:51.325489-03:00",
        "updated": "2020-03-26T12:54:51.325505-03:00",
        "customer": null,
        "gateway": "paypal",
        "usage": "single",
        "flow": "redirect",
        "data": {
            "redirect_url": "https://pay.paypal.com/webpayserver/initTransaction"
        }
    },
    "return_url": "https://api.simpledte.com/payments/pay_PzoIDAkGXidKVfjjf8/pay/",
    "metadata": {},
    "created": "2020-08-26T12:54:51.790395-03:00",
    "updated": "2020-08-26T12:54:51.790407-03:00"
}

Destroy a payment

DELETE https://api.piriod.com/payments/{{id}}/

Destroy a Payment object.

Path Parameters

Name
Type
Description

id

string

ID of the Payment object.

Authorize a payment

POST https://api.piriod.com/payments/{{id}}/authorize/

Path Parameters

Name
Type
Description

id

string

ID of the Payment object.

Request Body

Name
Type
Description

source

string

ID of the Source object to pay this Payment.

Pay a payment

GET https://api.piriod.com/payments/{{id}}/pay/

Path Parameters

Name
Type
Description

id

string

ID of the Payment object.

Last updated