Skip to main content

Global Prime Pay SDK

more info at https://doc.gbprimepay.com for python docs see https://thanakijwanavit.github.io/globalPrimePay/

Install

pip install globalPrimePay

How to use

  1. Get gbprime secrets
  2. pip install globalPrimePay
  3. python docs here

Secrets

GB prime should give you a password file which should include

this should also be available at your gbprime console in profile>show Key near the bottom of the page

public:Public Keysecret: Secret Key
token: Token / Customer Key

These key should be saved securely and should never be shared with the client or stored in the source code We recommend a secret storage service such as aws secrets manager if you are developing your app please use the test domain key

these secrets must be used when initiating the gbp client

Usage

Initiate a client

from globalPrimePay.client import Client
client = Client(pub = 'PUBLICKEY', secret='SECRETKEY', token='CLIENT TOKEN')

Pay with credit card

sampleCard = {
      "cardNumber": "4535017710535741",
      "expirationMonth": "05",
      "expirationYear": "28",
      "securityCode": "184",
      "name": "Watcharagon Phokonwong"
    }
cardToken = client.getCardToken(**sampleCard)['card']['token']
cardToken
'a76e0bc4-a5ed-4cf1-a6ca-33d185bc7509'

non-3d payment

# non-3d payment
client.chargeCard(
  token = cardToken,
  amount = 100,
  referenceNo = 'ref1',
  customerName = "nic",
  customerEmail = "nicsemail@gmail.com",
  detail =  'test order')
{'customerAddress': None,
 'amount': 100,
 'referenceNo': 'ref1',
 'messageToMerchant': None,
 'resultCode': '00',
 'customerTelephone': None,
 'resultMessage': 'Success',
 'customerName': 'nic',
 'customerEmail': 'nicsemail@gmail.com',
 'gbpReferenceNo': 'gbp173512113574',
 'merchantDefined5': None,
 'detail': 'test order',
 'merchantDefined3': None,
 'merchantDefined4': None,
 'merchantDefined1': None,
 'merchantDefined2': None}

3d payment

# payment
chargeCardResult = client.chargeCard(
  token = cardToken,
  amount = 100,
  referenceNo = 'ref1',
  customerName = "nic",
  customerEmail = "nicsemail@gmail.com",
  detail =  'test order',
  otp = 'Y'
)
chargeCardResult
{'customerAddress': None,
 'amount': 100,
 'referenceNo': 'ref1',
 'messageToMerchant': None,
 'resultCode': '00',
 'customerTelephone': None,
 'resultMessage': 'Success',
 'customerName': 'nic',
 'customerEmail': 'nicsemail@gmail.com',
 'gbpReferenceNo': 'gbp173512113578',
 'merchantDefined5': None,
 'detail': 'test order',
 'merchantDefined3': None,
 'merchantDefined4': None,
 'merchantDefined1': None,
 'merchantDefined2': None}

Verify OTP

client.verifyOtp(chargeCardResult['gbpReferenceNo'])
'<!DOCTYPE html>\n\n<html>\n  <head>\n    <title>GB Prime Pay</title>\n    <meta charset="UTF-8" />\n    <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n  </head>\n  <body>\n    <div>Loading...</div>\n    <div>\n      <form action="https://simbank.globalprimepay.com/pay/3d_secure" method="post">\n        <input type="hidden" name="MERID" value="21291800058" />\n        <input type="hidden" name="TERMINALID" value="18060001" />\n        <input type="hidden" name="PAN" value="4535017710535741" />\n        <input type="hidden" name="EXPIRYDATE" value="0528" />\n        <input type="hidden" name="CVV2" value="184" />\n        <input type="hidden" name="INVOICENO" value="2209270148" />\n        <input type="hidden" name="AMOUNT" value="10000" />\n        <input type="hidden" name="POSTURL" value="https://api.globalprimepay.com/web/thanachat_gateway/receive/goback" />\n        <input type="hidden" name="POSTURL2" value="https://api.globalprimepay.com/web/thanachat_gateway/receive/realtime" />\n        <input type="hidden" name="AUTOREDIRECT" value="Y" />\n      </form>\n    </div>\n    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>\n    <script type="text/javascript">\n      $(document).ready(function () {\n        $(\'form\').submit();\n      });\n    </script>\n  </body>\n</html>'

Metadata

Release files for globalPrimePay 0.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for globalPrimePay 0.0.16
File Size Uploaded Provenance
globalPrimePay-0.0.16.tar.gz 12.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for globalPrimePay 0.0.16
File Interpreter ABI Platform
globalPrimePay-0.0.16-py3-none-any.whl Python 3 none any Details

Total release size: 22.9 kB

Release files / globalPrimePay-0.0.16.tar.gz

Download URL globalPrimePay-0.0.16.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2a400998a0dbca46357024097fdd79950257a8e53bca7a0846ef788fdc7e0e3a
BLAKE2b-256 checksum
How to use checksums
787cc99e4c148a0f415994dc51860bf3ec0ec68cfb1cb89eb5714c25ad3364d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Release files / globalPrimePay-0.0.16-py3-none-any.whl

Download URL globalPrimePay-0.0.16-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f50fc160ac2e66c3ac09fc5b95b5b77eee30a588c74e7937b51ffee1a5e241a8
BLAKE2b-256 checksum
How to use checksums
1d56273a397acedcd35b76e1679793a89363bdf941858b95b2be3c5eacc0f35f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.13

Security for globalPrimePay 0.0.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page