Developer Center


This is the step that allows the invoice's status to be processed as "paid" upon notification by the payment service provider that the payment has been completed.

Here are the cases where you should use the function:

  • Forwarding the status of the payment to the "callback" link if using the "Third Party" method.
  • Forwarding the status of the payment to the "callback" link after the 3D verification stage.
  • Forwarding the status of payment for IPN messages to the "callback" connection.

If the purpose of the function is to approve the payment, first of all, the "checkout" variable should be defined as stated in the sample codes.

"get_checkout" Function

Two parameters are entered into the function.

The first parameter is the "checkout ID" number. The second parameter means the payment status of the "checkout" item is "unpaid" or "paid".

If you leave the second parameter blank, it will return the "checkout" item regardless. (This may cause duplicate invoices/services when duplicate requests are received. It is recommended to use the blank only when the payment is in the "approval" process.)

"set_checkout" Function

You can define a parameter to the function. The value you define should be the value returned from the "get_checkout" function.

Return Value

The return value of the function must be "array". Array keys and values are described below:

Name Type Mandatory Explanation
status string Yes The status of the payment may include the following:
successful : Indicates that the payment was successful.
pending: Indicates that payment is pending.
error: Indicates that the payment was unsuccessful.
message string or array No Used when you need to inform the admin about the payment. (Eg: The number related to the tracking of the payment)
Acceptable value: "array" and "string"
callback_message string No If it is defined, the value you entered will appear in front of the client. If it is not defined, the client will be directed to the "successful" or "failed" page, depending on the status of the payment.
paid Array No Info of the fee paid [amount] [currency]
paid [amount] Float Yes Amount of fee paid
paid[currency] String Yes Currency of the amount paid, eg: "USD,EUR,GBP,TRY"

Sample Usage

public function callback()
    // Obtain the custom id that you forwarded to the payment provider.
    $custom_id      = (int) Filter::init("POST/custom_id","numbers");

        $this->error = 'Custom id not found.';
        return false;

    // Let's get the checkout information.
    $checkout       = $this->get_checkout($custom_id);

    // Checkout invalid error
        $this->error = 'Checkout ID unknown';
        return false;

    // You introduce checkout to the system

    // You decide the status of the payment.

    return [
        /* You can define it as 'successful' or 'pending'.
            * 'successful' : Write if the payment is complete.
            * 'pending' : Write if the payment is pending confirmation.
        'status'            => 'successful',

            * You can host any id number for any information you need to report to the administrator after payment or for later use in returning the invoice. This information will be stored as JSON type in the invoices.pmethod_msg field in the database.
            * Acceptable value : 'array' and 'string'
        'message'        => [
            'Merchant Transaction ID' => '123X456@23',
            * When requests are sent to the callback address regarding the status of the payment, you can use this field to provide a specific response. If you do not use this field, the response will direct to the 'Payment Completed' page if the payment is successful, or to the 'Payment Failed' page if it is unsuccessful.
        'callback_message'        => 'Transaction Successful',
            * This index is optional and is used to indicate the total amount paid on the side of the payment intermediary. If the paid amount exceeds the total amount of the invoice, the excess is added to the invoice as a payment commission. This index contains two sub-indices: The first sub-index, 'amount', should be of the float type. 'Currency' refers to the currency code, which should be specified according to ISO 4217 standards.
        'paid'                    => [
            'amount'        => 15,
            'currency'      => "USD",
Refunds Checkout

Do you have any questions?

Feel free to contact us
Contact Us
Copyright © 2024. All Rights Reserved.
Join Our Discord Channel