Skip to content
FanakDocs
WebsiteDashboard

API reference

Retrieve a payment intent

GET
/payment-intents/{paymentIntent}
curl --request GET \
--url https://pay.fanak.ly/api/v1/payment-intents/4d893346-bd5e-482f-8347-3f509a877f1a \
--header 'Authorization: Bearer <token>' \
--header 'X-API-Key: <X-API-Key>'

Returns the intent’s current state. This is the source of truth for whether an order was paid: call it when a webhook arrives or the customer comes back from the checkout, and fulfil the order only when status is succeeded.

An intent created by another application returns 403.

paymentIntent
required
string format: uuid

The intent’s uuid.

Example

4d893346-bd5e-482f-8347-3f509a877f1a

The payment intent.

Media typeapplication/json
object
data
required
PaymentIntentResource
object
uuid
required

The intent’s ID. Store it with your order: you need it to retrieve the intent.

string format: uuid
reference
required

A short Fanak reference, shown to the customer on the checkout receipt (in capitals).

string | null
merchant_reference
required

The merchant_reference you created the intent with.

string | null
amount
required

The amount in the currency’s minor unit (5000 = 5.000 LYD).

integer
currency
required

ISO 4217 currency code

string
status
required

The intent’s state. requires_payment_method: waiting for the customer to pay (or to try again after a failed attempt). processing: a payment attempt is under way. succeeded: paid; final. canceled: expired unpaid; a verified late payment can still move it to succeeded. Fulfil the order on succeeded only.

string
Allowed values: requires_payment_method processing succeeded canceled
description
required

What the customer is paying for.

string | null
customer
required
object
external_id
required

Your identifier for the customer, if you sent one.

string | null
return_url
required

Where the hosted checkout sends the customer back, if you set one.

string | null
metadata
required

The key-value pairs you sent, returned as-is.

object | null
expires_at
required

When the checkout stops taking payments (ISO 8601).

string | null format: date-time
checkout_url
required

The hosted checkout page. Redirect the customer here to pay; append ?lang=en for English (Arabic is the default).

string format: uri
created_at
required
string | null format: date-time
updated_at
required
string | null format: date-time

Example

{
"data": {
"reference": "c5pk2mfgmv167awg",
"currency": "LYD",
"status": "requires_payment_method"
}
}

Missing or invalid credentials. A missing or invalid access token returns message; a missing or unknown API key returns error.

Media typeapplication/json
Any of:
object
message
required
string

Example generated

{
"message": "example"
}

An error

Media typeapplication/json
object
message
required

Error overview.

string

Example

{
"message": "Unauthorized access to payment intent."
}

No intent with this uuid. The body is {"message": "Not found."}.

Media typeapplication/json
object
message
required
string

Example generated

{
"message": "example"
}