Callback

Purpose

Processes callback data received from a payment gateway.

Mandatory

No.

Important: Officially, Callback is not Mandatory, meaning a plugin can be registered without implementing it. However, in practice, all plugin interaction scenarios— Modal, Redirect, Tokenizing, and 3D Secure—depend on the Callback method.

Input Parameters

An associative array that contains the following values:

Param name Description Type
callback_params The parameters received from the payment gateway. array
config The plug-in configuration values saved in the Billing database. array
environment The Billing environment information. Environment
account_info The account's details. AccountDetails
vendor_info The vendor's details. AccountDetails
document_info The payment document description. DocumentInfo

transaction_category

The transaction category for merchant-initiated payments (relevant and available only for transaction_initiator = MIT). Possible values are:

  • C: for Unscheduled Credential on File payments,
  • R: for recurring payments (payments at regular intervals).
string

transaction_moto

The parameter that defines whether it is the MOTO transaction. Possible values are:

  • true: for MIT payments on behalf of a customer,
  • transaction_moto is not sent: for CIT payments and recurring or renewing MIT payments.
boolean

transaction_initiator

The transaction initiator. Possible values are:

string
ref_no The Billing transaction identifier. integer
transaction_amount The transaction amount. double
currency_iso The currency of the transaction amount in the ISO format (for example, USD or EUR). string

current_lang

The current language. string
client_ip The IP from the client computer. string

The example of input parameters is shown below as a JSON object:

Response

An associative array that contains the following keys:

Param name

Description

Type

STATUS (Mandatory) The method execution status. Valid values for the Callback method are:
  • APPROVED: The request was successfully processed.
  • REDIRECT: (v21.4 and later) The request is successfully processed and the customer is redirected to the payment gateway.
  • PENDING: The request processing has the pending status in the Payment Gateway. The NEXT_TRANSACTION_GAP parameter may be used together with this status, so Billing can schedule the CheckStatus method call to verify whether the status is changed in the payment gateway. Refer to the NEXT_TRANSACTION_GAP parameter for details.
  • DECLINED: The request processing failed. The reason can be sent in the TEXT parameter.
  • ERROR: An error occurred while processing the request. The error reason can be sent in the TEXT parameter.
string
TEXT (Optional) The array that contains the following parameters:
  • customer_message: Contains text that will be displayed to a customer as a status message (String, optional).
  • vendor_message: Contains text that will be displayed to a vendor (String, optional).
array
REDIRECT_HASH

(Mandatory when STATUS is REDIRECT) Provides information for the redirect. The parameters are:

  • url: The URL where a customer is redirected (String, mandatory).
  • attrs: Parameters and values that will be used for the redirect (Array, mandatory).
  • method: The method used to pass the data: GET, POST. If not set, the POST method will be used (String, optional).
array
TRANSACTION_DETAIL

(Optional) The array that will be associated with the current transaction and will be represented back in an unchanged form as the value of the previous_transaction_data parameter at the next call of transaction processing methods of the plugin.

Note: Billing looks up the trans_id parameter that identifies a transaction on the gateway side to show it in the provider's UI. We highly recommend that you use this parameter.

array
NEXT_TRANSACTION_GAP

(Optional) The delay, in seconds, to dispatch the CheckStatus method call. This parameter may be used when the STATUS parameter is PENDING.

When Billing receives this parameter, it will schedule the CheckStatus method call event to be dispatched in NEXT_TRANSACTION_GAP seconds. It may be useful when the payment gateway expects API consumers to actively check a transaction status.

integer
ADD_NEW_METHOD

(Optional) When this array is returned in the Callback response, Billing tries to add a new payment method. For example, it creates a token after the redirect (for details, see Tokenizing a Payment Method). The parameters are:

  • paymethod_name: The payment method name to be created and stored in Billing (String, mandatory).
  • exp_date: The payment method expiration date. It is passed using the MM/YYYY format (String, optional).
  • external_id: The ID created by the payment gateway. Synchronizing that ID with the payment method in Billing is a good practice and can help in a manual conciliation (String, optional).
  • initial_status: The token initial status in Billing. Possible values are OK or PENDING. If not present, the OK value will be assumed (String, optional).

Other custom name-value pairs are allowed. They will be stored and passed to the plugin with the next payment operation.

array
NOTIFY_RESPONSE

(Optional) The array that can produce a response on the Notify URL request. The parameters are:

  • body: The HTTP response body (String, mandatory).
  • content_type: The HTTP header that indicates the media type of the resource in the response body (available values are text/plain, text/html, application/json) (String, mandatory).


The example of a response is shown below as a JSON object:

Example

The built-in Demo plugin implements the Callback method. The example below shows how this plugin implements it:

See Also

CloudBlue, an Ingram Micro business, uses cookies to improve the usability of our site. By continuing to use this site and/or logging in you are accepting the use of these cookies. For more information, visit our Privacy Policy.