Skip to main content

A simple implementation of HBL card payment integration in Python.

Project description

HBL Card Payment

Implementation of HBL PACO Core APIs for Card Payment with jose request.

APIs included:
✅ Payment
❌ Inquiry
❌ Void request
❌ Settlement
❌ Refund

Requirements

To get started, hit the 'clear' button at the top of the editor!

  • Python 3.x
  • Dependencies: PyJWT, requests, python-jose

Installation

You can install the package via pip:

pip install hbl-card-payment

Usage

Importing the Module

from hbl_card_payment.card_payment import HBLCardPayment

Initialization

Create an instance of HBLCardPayment with the required parameters:

payment = HBLCardPayment(
    merchant_id='your_merchant_id',
    api_key='your_api_key',
    encryption_key='your_encryption_key',
    callback_url='your_callback_url',
    merchant_signing_private_key='merchant_signing_private_key',
    paco_encryption_public_key='paco_encryption_public_key',
    merchant_decryption_private_key='merchant_decryption_private_key',
    paco_signing_public_key='paco_signing_public_key'
)

Making a Payment Request

Use the request method to make a payment request:

response = payment.request(
    order_no='123456789',
    product_desc='Product Description',
    amount=100.0
)

print(response)

Setting Additional Payload Values

If you need to set additional values in the request payload, use the set_value method:

payment.set_value('purchaseItems',
  [
      [
          "purchaseItemType" => "ticket",
          "referenceNo" => "2322460376026",
          "purchaseItemDescription" => "Bundled insurance",
          "purchaseItemPrice" => [
              "amountText" => "000000002000",
              "currencyCode" => "NPR",
              "decimalPlaces" => 2,
              "amount" => 1
          ],
          "subMerchantID" => "string",
          "passengerSeqNo" => 1
      ]
  ]
)

payment.set_value('customFieldList',
  [
      "fieldName" => "TestField",
      "fieldValue" => "This is test"
  ]
)

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

hbl-card-payment-0.0.2.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hbl_card_payment-0.0.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file hbl-card-payment-0.0.2.tar.gz.

File metadata

  • Download URL: hbl-card-payment-0.0.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.1

File hashes

Hashes for hbl-card-payment-0.0.2.tar.gz
Algorithm Hash digest
SHA256 e12ac274936b88a12cd5d7a6a80752594cbea95ac919604e7c071be8253f8838
MD5 5ffc3abc2837030d7c02a88f2863755e
BLAKE2b-256 065e65941adfe724282d0fb79ae4d1c8eb7fe634ff9fa1f11075ff5c2425dd9e

See more details on using hashes here.

File details

Details for the file hbl_card_payment-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for hbl_card_payment-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a32a6a5cd5a775e24fd9c4d5f5a5ae78f8dcd6eda6ba5bafd56c167b8e25314a
MD5 71111b46d9e9ce9ce8d5a0082b13d79a
BLAKE2b-256 816d827197c0bf978b43041e5e70b6f5a7154049511d752a8222342a6a2e65be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page