# The Payment object

> A payment is one attempt to collect an amount from a payer.

Source: https://rais.app/docs/api/objects/payment

You create it with `POST /payments`, send the payer to its `checkout_url`, and follow it until `status` is `paid`, or it fails, expires or is cancelled. Events about a payment carry this object in `data.object`.

## Attributes

- `id` (string): The unique identifier of the payment.
- `object` (string): The type of the object. Always `payment`.
- `status` (string): Where the payment stands. `pending`: waiting for the payer. `paid`: money received. `failed`: declined or errored (see `failure`). `cancelled`: you cancelled it. `expired`: nobody paid before `expires_at`. `refunded` / `partially_refunded`: money was returned. `reversed`: SATIM reversed the authorisation. One of `pending`, `paid`, `failed`, `cancelled`, `expired`, `refunded`, `partially_refunded`, `reversed`.
- `amount` (integer): The amount, in centimes.
- `currency` (string): The currency. Always `DZD`.
- `description` (string, nullable): What the payment is for.
- `reference` (string, nullable): Your own identifier of the order.
- `customer` (object, nullable): Who is paying, if known.
  - `id` (string, nullable): The id of the linked customer record, if any.
  - `name` (string, nullable): The payer's name.
  - `email` (string, nullable): The payer's e-mail address.
  - `phone` (string, nullable): The payer's phone number.
- `items` (array of object): What is being bought (empty if not given).
  - `name` (string): What was bought.
  - `description` (string, nullable): More detail.
  - `quantity` (integer): How many units.
  - `unit_amount` (integer): Price of one unit, in centimes.
- `metadata` (object): Your key/value pairs, as sent.
- `livemode` (boolean): `false` for a sandbox (test) payment, `true` for a live one.
- `payment_page` (string): The page the payer pays on. One of `rais`, `satim`.
- `checkout_url` (string): The hosted payment page. Redirect the payer here.
- `success_url` (string, nullable): Where the payer is sent after paying.
- `cancel_url` (string, nullable): Where the payer is sent if they cancel or fail.
- `expires_at` (integer, nullable): When an unpaid payment stops being payable (Unix time, seconds).
- `created` (integer): When the payment was created (Unix time, seconds).
- `paid_at` (integer, nullable): When the payment was paid (Unix time, seconds).
- `amount_refunded` (integer): How much has been refunded so far, in centimes.
- `refunded` (boolean): True once the payment is fully refunded.
- `fees` (object, nullable): What this payment cost you, in centimes, excluding VAT: SATIM's fee and Raïs's fee. Set once the payment is paid, `null` before. A test payment shows the simulated fees. They are not returned when the payment is refunded; each refund has its own fee (see the Refund object). See the pricing page.
  - `satim` (integer): SATIM's fee, in centimes, excluding VAT.
  - `rais` (integer): Raïs's fee, in centimes, excluding VAT.
  - `total` (integer): What the transaction costs: `satim` + `rais`, in centimes, excluding VAT.
- `net` (integer, nullable): What you receive for this payment: `amount` minus `fees.total`, in centimes, before any refund. `null` until it is paid.
- `receipt_url` (string, nullable): Where the receipt can be downloaded once the payment is paid.
- `failure` (object, nullable): Why the payment failed; set when `status` is `failed`.
  - `code` (string): Why it failed, machine-readable: `payment_declined`, `processing_error`, `gateway_unavailable`, `refund_declined`...
  - `message` (string): Why it failed, in words.
- `payment_method` (object, nullable): How the payer paid; set once the payment is paid.
  - `type` (string): The kind of payment method. Always `card`.
  - `brand` (string): The card scheme: `cib`, `dahabia` or `unknown`.
  - `last4` (string): The last four digits of the card.
  - `masked` (string): The card number as masked by SATIM (first six and last four digits at most).
- `processor` (object): What the processor (SATIM) knows about the payment.
  - `name` (string): The payment processor. Always `satim`.
  - `order_id` (string, nullable): SATIM's identifier of the order.
  - `approval_code` (string, nullable): The authorisation code, once the payment is approved.
  - `response_code` (string, nullable): SATIM's response code (`00` = approved).

## Example

```json
{
  "id": "5b1c2f4e-9d3a-4c61-8a7e-0f2d6b9e1a33",
  "object": "payment",
  "status": "pending",
  "amount": 500000,
  "currency": "DZD",
  "description": "Order #1042",
  "reference": "order-1042",
  "customer": {
    "id": null,
    "name": "Amina Benali",
    "email": "amina@example.dz",
    "phone": "+213550000000"
  },
  "items": [
    {
      "name": "Running shoes",
      "description": null,
      "quantity": 2,
      "unit_amount": 250000
    }
  ],
  "metadata": {
    "cart_id": "c_8812"
  },
  "livemode": false,
  "payment_page": "rais",
  "checkout_url": "https://pay.rais.app/pay/5b1c2f4e-9d3a-4c61-8a7e-0f2d6b9e1a33",
  "success_url": "https://shop.example/thanks",
  "cancel_url": "https://shop.example/cart",
  "expires_at": 1793003600,
  "created": 1793000000,
  "paid_at": null,
  "amount_refunded": 0,
  "refunded": false,
  "fees": null,
  "net": null,
  "receipt_url": null,
  "failure": null,
  "payment_method": null,
  "processor": {
    "name": "satim",
    "order_id": "V721uPPfNNofVQAAABL3",
    "approval_code": null,
    "response_code": null
  }
}
```
