Skip to content

Latest commit

 

History

History
152 lines (108 loc) · 3.71 KB

README.md

File metadata and controls

152 lines (108 loc) · 3.71 KB

GrabPay Merchant Integration SDK for Python

Using the SDK

For using this SDK, you might copy all files in src folder and paste it to your project. Then you should import 2 classes MerchantIntegrationOnline, MerchantIntegrationOffline in src folder.

Configuring the SDK

  • stage : String : either "PRD" or "STG"
  • country : String : ISO 3166-1 Alpha-2 country code of the merchant location.
  • partner_id : String - Unique ID for a partner. Retrieve from Developer Home
  • partner_secret : String - Secret key for a partner. Retrieve from Developer Home
  • merchant_id : String - Retrieve from Developer Home
  • terminal_id : String - Retrieve from Developer Home (POS only)
  • client_id : String - Retrieve from Developer Home (OTC only)
  • client_secret : String - Retrieve from Developer Home (OTC only)
  • redirect_url : String - The url configured in Developer Home (OTC only)

One-Time Charge (OTC) Transactions

Configuring for One-Time Charge

from MerchantIntegrationOnline import MerchantIntegrationOnline

callOna = MerchantIntegrationOnline(stage, country, partner_id, partner_secret, merchant_id, client_id, client_secret, redirect_url)

One-Time Charge (OTC) API

  1. Charge Init:
respChargeInit = callOna.onaChargeInit(
        partnerTxID,
        partnerGroupTxID,
        amount,
        currency,
        description,
        metaInfo={},
        items={},
        shippingDetails={},
        hidePaymentMethods=[]
)
  1. Create Web Url:
respChargeInit = callOna.onaCreateWebUrl(
    partnerTxID,
    partnerGroupTxID,
    amount,
    currency,
    description,
    codeVerifier,
    metaInfo={},
    items={},
    shippingDetails={},
    hidePaymentMethods=[],
    state=None
)
  1. get OAuth Token
respAuthCode = callOna.onaOAuthToken(code, codeVerifier)
  1. Charge Complete
respChargeComplete = callOna.onaChargeComplete(partnerTxID, respAuthCode.access_token)

5 Get Charge status

respChargeStatus = callOna.onaGetChargeStatus(partnerTxID, currency, respAuthCode.accessToken)
  1. refund online
response = callOna.onaRefund(refundPartnerTxID, amount, origPartnerTxID, description, respAuthCode.accessToken, currency)
  1. Get Refund Status
response = callOna.onaGetRefundStatus(partnerTxID, respAuthCode.accessToken, currency)
  1. Get One time charge status
    response = callOna.onaGetOtcStatus(partnerTxID, respAuthCode.accessToken, currency)

Point of Sale (POS) Transactions

Configuring for Point of Sale

from MerchantIntegrationOffline import MerchantIntegrationOffline

callPos = MerchantIntegrationOffline(stage, country, partner_id, partner_secret, merchant_id, terminal_id)

Point of Sale (POS) API

  1. Create QR Code
respCreateQRCode = callPos.posCreateQRCode(msgID, partnerTxID, amount, currency)
  1. Get transaction status:
resp = callPos.posGetTxnStatus(msgID, partnerTxID, currency)
  1. cancelTxn
resp = callPos.posCancel(msgID, partnerTxID, origPartnerTxID, origTxID, currency)
  1. refund Pos transaction
resp = callPos.posRefund(msgID, partnerTxID, originTxID, amount, description, currency)
  1. Get refund transaction status:
resp = callPos.posGetRefundStatus(msgID, partnerTxID, currency)
  1. performTxn
resp = callPos.posPerformQRCode(msgID, partnerTxID, amount, code, currency)

License

© 2022 GrabTaxi Holdings Pte Ltd. All rights reserved. Any use of such assets are governed by the API Terms and Conditions (available at Grab Developer).