Skip to main content

Payment Gateway

Project description

CamPay Python SDK

Python SDK for CamPay Payment Gateway

CamPay is a Fintech service of the company TAKWID GROUP which launched its financial services in Cameroon from January 2021.

We provide businesses and institutions with solutions for collecting and transferring money online, via primarily Mobile Money(MTN and Orange).

With CamPay, simplify the purchasing experience for your customers thanks to our mobile money payment solutions, accessible via your website and/or mobile application.

Summary

Getting Started

These instructions will get you started with the CamPay SDK for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

  • Create an account on CamPay platform
  • Register an application under your account.
  • Expand your registered application to get access to your API keys

Installing

     pip install campay

Running the samples

  • Initialize the library with credentials.
        from campay.sdk import Client
    
        campay = Client({
            "app_username" : "PASTE YOUR APP_USERNAME HERE",
            "app_password" : "PASTE YOUR APP_PASSWORD HERE",
            "environment" : "DEV" #use "DEV" for demo mode or "PROD" for live mode
        })
    

To collect payments from your client - DIRECTLY

      collect = campay.collect({
         "amount": "5", #The amount you want to collect
         "currency": "XAF",
         "from": "2376xxxxxxxx", #Phone number to request amount from. Must include country code
         "description": "some description"
      })

      print(collect)
      #{"reference": "bcedde9b-62a7-4421-96ac-2e6179552a1a", "status": "SUCCESSFUL", "amount": 5, "currency": "XAF", "operator": "MTN", "code": "CP201027T00005", "operator_reference":  "1880106956" }
      

status can be SUCCESSFUL or FAILED

To collect payments from your client - using PAYMENT LINKS

      payment_link = campay.get_payment_link({
         "amount": "5",
         "currency": "XAF",
         "description": "some description",
         "external_reference": "12345678",
         "redirect_url": "https://mysite.com/"
      })

      print(payment_link)
      #{"status": "SUCCESSFUL", "link": "https://www.campay.com/pay/with/link/" }
      '''
      Redirect your customer to the returned payment link 
      '''
      

status can be SUCCESSFUL or FAILED

To disburse

Please enable API withdrawal under app settings before trying this request

     disburse = campay.disburse({
         "amount": "5", #The amount you want to disburse
         "currency": "XAF",
         "to": "2376xxxxxxxx", #Phone number to disburse amount to. Must include country code
         "description": "some description"
     })

     print(disburse)
     #{"reference": "bcedde9b-62a7-4421-96ac-2e6179552a1a", "status": "SUCCESSFUL", "amount": 5, "currency": "XAF", "operator": "MTN", "code": "CP201027T00005", "operator_reference":  "1880106956" }

status can be SUCCESSFUL or FAILED

To Get application balance.

     balance = campay.get_balance()

     print(balance)
     #{"total_balance": 0, "mtn_balance": 0, "orange_balance": 0, "currency": "XAF"}

Deployment

Change the environment of the library introduction to PROD

      from campay.sdk import Client
      campay = Client({
          "app_username" : "PASTE YOUR APP_USERNAME HERE",
          "app_password" : "PASTE YOUR APP_PASSWORD HERE",
          "environment" : "PROD" #use "DEV" for demo mode or "PROD" for live mode
      })

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

campay-1.0.3.tar.gz (16.6 kB view hashes)

Uploaded source

Built Distribution

campay-1.0.3-py3-none-any.whl (18.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page