Other payment methods

Documentation

Contact Support

Other payment methods

Certainly, you can use any other local payment provider for subscription.

For the integration you need:

1. Add a new provider to the database.

All providers are stored in the “deposit_methods” table. Add a new line in the phpMyAdmin interface:

- id: it is generated automatically

- name: it is the name of the provider that is available for the user

- logo: it is the name of the logo file that you need to place at public_html/deposit

- status: 1, if the provider is active and used for subscriptions. Keep in mind that you can only have one active payment provider

- api_value (1,2,3): these are free variables that you may need for payment provider integration

- route: the address where the call for users` subscription and unsubscription are available

2. Create new controllers:

- app/Controllers/Api/Customer/Payment/{name_provider}/CreatePaymentRequest.php

This controller must be used to make the first payment for your subscription. Here {name_provider} is the name of the folder with your payment provider.

- app/Controllers/Api/Customer/Payment/{name_provider}/CancelSubscribe.php

This controller cancels a previously issued subscription. Please note that this controller is also used at the admin level for canceling a subscription from the control panel.

- app/Controllers/Ipn/{name_provider}.php

This controller processes incoming notifications from the payment provider about subscription events, new transactions, subscription cancellations, etc.

If your payment provider doesn't provide payment cycle management methods, you need to implement the subscription expiration date and customer's credit card charging self-checking. You can use the table “payment_intent” and the data model app/Models/PaymentIntenModel.php for this.

This model is used according to the following scheme:

- id: it is generated automatically. A unique value for each entry

- subscribe_id: it is subscription ID from the “subscribes” table “subscribes”

- method_id: Payment provider ID from the “deposit_methods” table

- is_pending: 1 if the subscription is not canceled this line is used to track the subscription and charge the customer's credit card

- payment_token: a free value that is used to charge the client's credit card

- planned_at: date when you need to start checking the client's subscription

-Flangapp does not schedule or check this table automatically. You have to develop the logic for checking values in the table by yourself, for example by running regular CRON tasks.

All controllers and methods should be registered in the routing control file app/Config/Routes.php. Controllers for creating subscription and unsubscription are registered in the private routes zone;

controllers for processing incoming notifications are registered in the public routes zone without prior authorization.