Package: merchant001_sdk
Merchant001 SDKInstallClient-onlyFor PIPpip3installmerchant001_sdkFor PDMpdmaddmerchant001_sdkWith CLIFor PIPpip3installmerchant001_sdk[cli]For PDMpdmaddmerchant001_sdk[cli]UseClientSyncfrommerchant001_sdkimportClientwithClient(token=...)asclient:# comming soon...Asyncfrommerchant001_sdkimportClientasyncdefmain(token:str)->None:asyncwithClient(token=token)asclient:# comming soon...MethodsIn this section I use async-only, but you can use sync/async (as in previous 2-level section).Merchant Healthcheckfrommerchant001_sdkimportClientasyncdefmain(token:str)->None:asyncwithClient(token=token,endpoint="https://api.merchant001.io/")asclient:result=awaitclient.get_merchant_healthcheck()print(result)On Success:MerchantHealthcheck(success=True)On Error (invalid token for example):ErrorResult(status_code=401,message='Unavailable api token',error='Unauthorized')Payment Methods ListParams:raw_dict (boolean) - eq. to makeArray, default is false.method_names_only (boolean) - eq. to onlyMethod, default is false.amount (int; > 0) - eq. to amount, default is null (optional).frommerchant001_sdkimportClientasyncdefmain(token:str)->None:asyncwithClient(token=token,endpoint="https://api.merchant001.io/")asclient:result=awaitclient.get_payment_methods(raw_dict=True,method_names_only=False)print(result)On Success:[PaymentMethodType(type='GATE [RUB/USDT] CARD',methods=[{'type':'GATE [RUB/USDT] CARD','method':'tinkoff','imageUrl':None,'name':'Тинькофф'},{'type':'GATE [RUB/USDT] CARD','method':'sberbank','imageUrl':None,'name':'Сбербанк'}])]# raw_dict=False[PaymentMethodType(type='GATE [RUB/USDT] CARD',methods=['tinkoff','sberbank'])]# raw_dict=False, method_names_only=True{'GATE [RUB/USDT] CARD':{'tinkoff':{'type':'GATE [RUB/USDT] CARD','method':'tinkoff','imageUrl':None,'name':'Тинькофф'},'sberbank':{'type':'GATE [RUB/USDT] CARD','method':'sberbank','imageUrl':None,'name':'Сбербанк'}}}# raw_dict=TrueOn Error (invalid token for example):ErrorResult(status_code=401,message='Unavailable api token',error='Unauthorized')Create TransactionParams:
pricing (mapping[str, mapping[str, str | float]]) - eq. to pricing.
provider_type (str) - eq. to selectedProvider.type.
provider_method (str) - eq. to selectedProvider.method.
is_partner_fee (boolean) - eq. to amount, default is null (optional).frommerchant001_sdkimportClientasyncdefmain(token:str)->None:asyncwithClient(token=token,endpoint="https://api.merchant001.io/")asclient:result=awaitclient.create_transaction(pricing={"local":{"amount":1,"currency":"RUB"}},provider_type="GATE [RUB/USDT] CARD",provider_method="SBERBANK",is_partner_fee=False,)print(result)Get TransactionParams:transaction_id (str)frommerchant001_sdkimportClientasyncdefmain(token:str,transaction_id:str)->None:asyncwithClient(token=token,endpoint="https://api.merchant001.io/")asclient:result=awaitclient.get_transaction(transaction_id=transaction_id)print(result)Get Transaction RequisiteParams:transaction_id (str)frommerchant001_sdkimportClientasyncdefmain(token:str,transaction_id:str)->None:asyncwithClient(token=token,endpoint="https://api.merchant001.io/")asclient:result=awaitclient.get_transaction_requisite(transaction_id=transaction_id)print(result)Claim Transaction as PAIDParams:transaction_id (str)frommerchant001_sdkimportClientasyncdefmain(token:str,transaction_id:str)->None:asyncwithClient(token=token,endpoint="https://api.merchant001.io/")asclient:result=awaitclient.claim_transaction_paid(transaction_id=transaction_id)print(result)Claim Transaction as CANCELEDParams:transaction_id (str)frommerchant001_sdkimportClientasyncdefmain(token:str,transaction_id:str)->None:asyncwithClient(token=token,endpoint="https://api.merchant001.io/")asclient:result=awaitclient.claim_transaction_canceled(transaction_id=transaction_id)print(result)Set Transaction payment methodParams:transaction_id (str)provider_type (str)provider_method (str)frommerchant001_sdkimportClientasyncdefmain(token:str,transaction_id:str,provider_type:str,provider_method:str)->None:asyncwithClient(token=token,endpoint="https://api.merchant001.io/")asclient:result=awaitclient.set_transaction_payment_method(transaction_id=transaction_id,provider_type=provider_type,provider_method=provider_method,)print(result)Get Payment Method RateParams:payment_method (str)frommerchant001_sdkimportClientasyncdefmain(token:str,payment_method:str)->None:asyncwithClient(token=token,endpoint="https://api.merchant001.io/")asclient:result=awaitclient.get_payment_method_rate(payment_method=payment_method)print(result)On Success:PaymentMethodRate(method='sberbank',rate=103.38)Upload payment receiptParams:transaction_id (str)receipt_file (str) - filepath or opened file with mode "rb".amount (float; optional) - if you need to specify the amount.frommerchant001_sdkimportClientasyncdefmain(token:str,transaction_id:str,filepath:str,amount:int)->None:asyncwithClient(token=token,endpoint="https://api.merchant001.io/")asclient:result=awaitclient.upload_payment_receipt(transaction_id=transaction_id,receipt_file=filepath,amount=amount)print(result)On Success:StatusStub(status=True)