Icepay Rest API的客户端
icepay-python的Python项目详细描述
Icepay Python客户端
用于icepay rest api的python客户端,https://icepay.com/docs/rest-api/
安装
pip install icepay-python
用法
fromicepayimportIcepayClient#init clientclient=IcepayClient(MERCHANT_ID,SECRET_CODE)#get own payment methodspayment_methods=client.GetMyPaymentMethods()#checkoutorder_data=client.Checkout({"Amount":"1","Country":"US","Currency":"EUR","Description":"Test","EndUserIP":"127.0.0.1","PaymentMethod":"PAYPAL","Issuer":"DEFAULT","Language":"EN","OrderID":"10000031","URLCompleted":"https://mywebshop.com/Payment/Success","URLError":"https://mywebshop.com/Payment/Failure"})#get payment info by idpayment=client.GetPayment(1232)#validate postback checksum# request.POST is dict or QueryDict with key:value map of post data# throws AssertionError on failureclient.validate_postback(request.POST)#generate URL for the BASIC payment modeurl=client.getBasicPaymentURL({'IC_OrderID':123,'IC_Amount':100,'IC_Currency':'EUR','IC_Country':'US','IC_URLCompleted':'https://mywebshop.com/Payment/Success','IC_URLError':'https://mywebshop.com/Payment/Failure'})
高级用法
#make an API call for an endpoint that doesnt have a helper in this lib#note that timestamp is auto added if it's not presentvalues={#request data}order=client.call_api('POST','payment/vaultcheckout',values)