def checkout(self): gateway = AfricasTalkingGateway(self.APP_USERNAME, self.API_KEY) # Specify the name of your Africa's Talking payment product productName = "ABC" # The phone number of the customer checking out phoneNumber = "+25471XXXXXX" # The 3-Letter ISO currency code for the checkout amount currencyCode = "KES" # The checkout amount amount = 100.50 # Any metadata that you would like to send along with this request # This metadata will be included when we send back the final payment notification metadata = {"agentId": "654", "productId": "321"} # The provider channel the payment will be initiated from e.g a paybill number providerChannel = None try: # Initiate the checkout. If successful, you will get back a transactionId transactionId = gateway.initiateMobilePaymentCheckout( productName, phoneNumber, currencyCode, amount, metadata, providerChannel) print "The transactionId is " + transactionId except AfricasTalkingGatewayException, e: print 'Received error response: %s' % str(e)