def b2b(self): gateway = AfricasTalkingGateway(self.APP_USERNAME, self.API_KEY) # Specify the name of your Africa's Talking payment product productName = "ABC" # The 3-Letter ISO currency code for the checkout amount currencyCode = "KES" # Specify the amount to transfer amount = 100 # Specify the payment provider. eg. MPESA, ATHENA (AfricasTalking Sandbox), etc provider = "myPaymentProvider" # Specify partner's business channel destinationChannel = "partnerBusinessChannel" # Specify partner's business channel account if needed. This is optional destinationAccount = "partnerBusinessChannelAccount" # Specify the transfer purpose transferType = "BusinessToBusinessTransfer" # Group providerData in a dict. This is done for convenience providerData = { 'provider': provider, 'destinationChannel': destinationChannel, 'destinationAccount': destinationAccount, 'transferType': transferType } # Specify the metadata options. These data will be sent to you in a notification when payment has been made metadata = {'shopId': "1234", 'itemId': "abcde"} try: response = gateway.mobilePaymentB2BRequest(productName, providerData, currencyCode, amount, metadata) print 'Encountered an error while sending: %s' % response['status'] if (response['status'] == "Queued"): print 'transactionId=%s;transactionFee=%s;providerChannel=%s;' % ( response['transactionId'], recipient['transactionFee'], recipient['providerChannel']) else: print 'errorMessage: %s' % response['errorMessage'] except AfricasTalkingGatewayException, e: print 'Received error response: %s' % str(e)