Recurring payments make it possible to take funds from the customer's card periodically or on demand once the customer has authorised the initial payment. Recurring payments are useful, for example, for various subscriptions or services with monthly fees.
The payment gateway makes it possible to carry out two types of recurring payments.
automatic recurring payments – the repetition period and the amount are set with the initial payment and the payments then take place automatically
recurring payments on demand – each subsequent payment has to be taken by a request to the REST API from the merchant; the advantage is being able to control the amount and the time of taking further payments
💡 GoPay tip:
The recurring payments function is available by default in the payment gateway test environment. If you want to activate recurring payments for your merchant outlet in the production environment, please contact GoPay support at [email protected].
Automatic recurring payments
An automatic recurring payment is created by a request to the REST API from the merchant's portal.
The settings of the recurring payment are determined by the recurrence object, whose parameters are:
recurrence_cycle – defines the cycle of the recurring payment and can take the values
DAY,WEEK,MONTHrecurrence_period – defines the repetition period within the given cycle
for example, if recurrence_cycle is set to
DAYand recurrence_period to 3, the recurring payment will be made every 3rd day
recurrence_date_to – defines the validity of the recurring payment
the payment gateway system will take it automatically until this date
it must contain a date value greater than the current date and less than 2099-12-31
💡 GoPay tip:
Creating a recurring payment has to be authorised using a token. You will find more information about the process of obtaining a token in the article describing the payment gateway integration procedure.
Use of the payments
Automatic recurring payments are useful for services with a regular payment of the same amount, e.g. a magazine subscription whose price does not change.
Recurring payments on demand
A recurring payment on demand is created by the same request to the REST API as an automatic payment, but differs in the setting of the recurrence_cycle parameter.
For an on-demand payment, recurrence_cycle takes only the value ON_DEMAND. recurrence_period, on the other hand, is not used in this case.
Subsequent payments are taken via an API request which allows the following to be specified for the subsequent payment:
a custom amount
amountthe order number
order_numberthe order description
order_descriptionthe purchase items (items)
additional optional payment parameters (additional_params)
The response to creating a subsequent payment is an object describing the state and parameters of the newly created subsequent payment.
💡 GoPay tip:
If a payment fails, we recommend making at least 3 attempts to take it. If none of the attempts is successful, the repetition may be cancelled.
Use of the payments
Recurring payments on demand are useful for services with an irregular payment or a payment based on use of the service.
Paying the payment
The response to creating a recurring payment is an object describing the state of the newly created payment, which also includes the gw_url parameter that you use to invoke the payment gateway in inline or redirect form.
The customer has to pay this newly created initiating recurring payment, thereby authorising further subsequent automatic recurring payments.
Notifications
Subsequent payments are notified using standard http notifications, see the notifications section in the article describing the payment gateway integration procedure.
The notification of a subsequent payment also contains the GET parameter parent_id, which contains the id of the initiating payment.
💡 GoPay tip:
HTTP notifications can also be sent if the customer cancels the repetition of the payment. If you want to be informed of this action by the customer, please contact GoPay's technical department at [email protected].
