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.3.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.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hbl-card-payment-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 96cda8f32926d8d7550b62145ef57196c0f8441abf10242c70808c6f862b81bc
MD5 7ab41ddc6f47790731f8a025f5d6c812
BLAKE2b-256 18f9825a95828be70226b902ea87828d881f523446553128be6c57bb29d32e71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hbl_card_payment-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 05cd3cdd1d9acdc1eb12547cf6e064a478f7566fea5f5c91b4b827699d022e48
MD5 7d7f63656f78ec339a3e3a649c9758b9
BLAKE2b-256 9a45bef92b96fe54120deaf2de89a04d39fb7e015c181030582a073c56bd7eaa

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