CinetPay SDK-FLUTTER integration


MIT License CinetPay Logo

This package allows you to invoke the CinetPay counter, make a payment and wait for the status of the payment to be initiated to the second after the payment is completed

🔗 the Steps

The use of the package is the simplest possible, in its use, it is to invoke it with :

  • The initialization parameters of the counter
  • The data related to the payment
  • The callback waiting for the payment return
  • The callback for listening to the execution error

🛠 Requirements

Some prerequisites are needed to make the package work properly.

  • Android

    • Add the following permissions to the file. android/app/src/main/AndroidManifest.xml

          <application
              ...
              android:usesCleartextTraffic="true">
              ...
          </application>
          ...
          <uses-permission android:name="android.permission.INTERNET"/>
    • Change the version of the minSdkVersion in the android/app/src/build.gradle file

      minSdkVersion 17

  • IOS

    • Add the following permission to the file ios/Runner/Info.plist

          <key>NSAppTransportSecurity</key>
          <dict>
              <key>NSAllowsArbitraryLoads</key>
              <true/>
          </dict>

Initialization of the counter

To function, the counter must receive data such as :

  • apikey | The merchant ID | String | Mandatory
  • site_id | The service identifier | Integer | Obligatory
  • notify_url | Valid payment notification | URL | Mandatory

Payment data

In order to make the payment, some data must be submitted to prepare the counter. Thus, we have :

  • amount | Payment amount (>= 100 XOF) | Integer | Obligatory
  • currency | Currency of payment (XOF - XAF - CND - GNF - USD) | String | Obligatory
  • Transaction_id | The transaction identifier. It must be unique for each transaction| Obligatory.
  • description | The description of your payment| Obligatory.
  • channels | The payment universe. Can be: ALL - MOBILE_MONEY - CREDIT_CARD - WALLET. Default: 'ALL' Any combination is applicable to comma separated: 'MOBILE_MONEY, WALLET' | Character string | Optional
  • metadata** | String | Optional
  • customer_name | Customer name * | Character string | Optional
  • customer_surname | First name of the buyer * | String | Optional
  • customer_email | Buyer's email address * | String | Optional
  • customer_phone_number | Buyer's phone number * | String | Optional
  • customer_city | Buyer's city * | Character string | Optional
  • customer_country | Buyer's country. ISO2 country code (CI => Ivory Coast). Optional
  • customer_state | String| Buyer's state (when USA is used as country) * | String | Optional
  • customer_zip_code | Buyer's Zip Code * | Character string | Optional

    Note : * Mandatory if using the banking universe (CREDIT_CARD)

Payment return callback

When the payment is initiated, the package waits for the final status of the payment. Thus, at the end of the payment the package receives the status, which it transmits through the callback that will be defined. The expected return format is the following:

  • amount | Payment amount | Integer
  • currency | Payment currency | Character string
  • Status | Status of the payment (ACCEPTED or REFUSED) | Character string
  • Payment_method | Payment method | Character string
  • description | The description of your payment | Character string
  • metadata | String
  • operator_id | The operator's payment ID | String
  • payment_date | The date of the payment | String

Processing error callback

During processing, certain types of errors may occur such as, some parameters for the payment are missing. The expected return format is as follows:

  • message | String
  • description| String

👩‍💻 Use of the package

In summary, the package is used through a widget call:

CinetPayCheckout(
    title: 'Guichet de paiement',
    configData: <String, dynamic> {
        'apikey': 'YOUR_API_KEY',
        'site_id': YOUR_SITE_ID,
        'notify_url': 'https://mondomaine.com/notify/'
    },
    paymentData: <String, dynamic> {
        'transaction_id': 'YOUR_TRANSACTION_ID',
        'amount': 100,
        'currency': 'XOF',
        'channels': 'ALL',
        'description': 'Test de paiement'
    },
    waitResponse: (response) {
        print(response);
    }
    onError: (error) {
        print(error);
    }
);

CinetPay Checkout

Exemple

Example of use of the FLUTTER SDK


Read more