Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/scooller/Leben-site/llms.txt

Use this file to discover all available pages before exploring further.

After a checkout transaction is initiated, iLeben creates a Payment record that tracks the transaction lifecycle from pending through to completed, failed, or one of the other statuses defined in the PaymentStatus enum. The endpoints below let authenticated users retrieve their payment history and upload transfer proof for manual payments. A separate public-status endpoint allows result pages to display payment state without requiring the buyer to be logged in.

Authentication

Most endpoints require both auth:sanctum and token.origin middleware:
  • Header: Authorization: Bearer <token>
  • Header: Origin: <your-authorized-origin> (or Referer / X-Authorized-Url)
The public-status endpoint (GET /api/v1/payments/public-status/{id}) is unauthenticated and uses a token query parameter instead.

GET /api/v1/payments

List all payments for the authenticated user. Returns a paginated collection of payment records belonging to the current session’s user.

GET /api/v1/payments/

Retrieve the full payment record for a single transaction.

Path parameters

id
integer
required
The internal iLeben payment ID returned at checkout.

POST /api/v1/payments//manual-proof

Upload a proof-of-payment file for a manual bank transfer. After the file is uploaded, an admin reviews and approves or rejects the payment from the Filament admin panel.

Path parameters

id
integer
required
The internal iLeben payment ID for the manual payment being confirmed.

Request

Content-Type: multipart/form-data
proof
file
required
Proof-of-payment image or document. Accepted formats: jpg, jpeg, png, pdf, heic, heif. Maximum size: 5 MB.
notes
string
Optional notes from the buyer to accompany the proof, e.g. transfer date or bank reference number. Maximum 1000 characters.

After upload

1

Buyer uploads proof

POST /api/v1/payments/{id}/manual-proof with the file attached as proof.
2

Admin reviews in Filament

The uploaded file appears in the Filament admin panel under the payment record. An admin inspects the proof against bank records.
3

Admin approves or rejects

The admin calls approvePayment() from the panel, which transitions the payment to completed, or marks it failed with a reason.

GET /api/v1/payments/public-status/

Retrieve the current status of a payment without authentication. This endpoint is designed for the post-checkout result page shown to buyers after a redirect-based payment flow.

Authentication

None. This endpoint is public. Access is controlled by the token query parameter, which must match the public_status_token (also returned at checkout as payment_status_token for Transbank) associated with the payment.

Path parameters

id
integer
required
The internal iLeben payment ID.

Query parameters

token
string
required
The public_status_token (UUID) returned in the checkout response. This token acts as a bearer credential for this single public endpoint.

Responses

CodeMeaning
200Payment found and status returned successfully.
422The token query parameter is missing from the request.
404The token is invalid or does not match the payment ID.

Payment status values

The PaymentStatus enum defines all possible states a payment record can hold:
ValueDescription
pendingTransaction initiated; awaiting gateway confirmation.
processingGateway is processing the payment asynchronously.
authorizedFunds authorized but not yet captured (marks the plant as unavailable).
completedPayment confirmed and accepted.
failedPayment rejected or errored.
cancelledPayment was cancelled before completion.
refundedPayment was fully refunded.
partially_refundedPayment was partially refunded.
expiredPayment window lapsed before the transaction was completed.
pending_approvalManual payment awaiting admin review after proof upload.

Web routes for payment results

After gateway redirects, buyers land on result pages served by web routes defined outside /api/v1:
GET /payments/success/{payment?}
GET /payments/failed/{payment?}
GET /payments/pending/{payment?}
These views receive the Payment model and display the appropriate outcome screen to the buyer.

Payment model reference

Query scopes

Use these Eloquent scopes to filter payments programmatically in backend code:
// completed() matches status: completed, authorized
Payment::completed()->get();

// pending() matches status: pending, processing, pending_approval
Payment::pending()->get();

// failed() matches status: failed, cancelled, expired
Payment::failed()->get();

Payment::byGateway(PaymentGateway::TRANSBANK)->get();

Status helper methods

$payment->isCompleted();    // bool — true when status is completed or authorized
$payment->isPending();      // bool — true when status is pending, processing, or pending_approval
$payment->isFailed();       // bool — true when status is failed, cancelled, or expired
$payment->canBeRefunded();  // bool — true when the payment is eligible for refund
$payment->canBeApproved();  // bool — true for manual payments awaiting approval (pending_approval)

State transition helpers

$payment->markAsCompleted();
$payment->markAsFailed('Motivo del rechazo');

Build docs developers (and LLMs) love