Skip to main content

template, plz check

Project description

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>'

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

globalPrimePay-0.0.16.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

globalPrimePay-0.0.16-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file globalPrimePay-0.0.16.tar.gz.

File metadata

  • Download URL: globalPrimePay-0.0.16.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for globalPrimePay-0.0.16.tar.gz
Algorithm Hash digest
SHA256 2a400998a0dbca46357024097fdd79950257a8e53bca7a0846ef788fdc7e0e3a
MD5 620b46ba1ea8f4e59876c0af5fe58e3f
BLAKE2b-256 787cc99e4c148a0f415994dc51860bf3ec0ec68cfb1cb89eb5714c25ad3364d7

See more details on using hashes here.

File details

Details for the file globalPrimePay-0.0.16-py3-none-any.whl.

File metadata

File hashes

Hashes for globalPrimePay-0.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 f50fc160ac2e66c3ac09fc5b95b5b77eee30a588c74e7937b51ffee1a5e241a8
MD5 8a48b9fbca0c86d86dd8ea50f0b1ff0d
BLAKE2b-256 1d56273a397acedcd35b76e1679793a89363bdf941858b95b2be3c5eacc0f35f

See more details on using hashes here.

Supported by

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