Integrate with RBS WorldPay Hosted Payment Page (XML Redirect) using Python


Does anyone have any example code for integrating with RBS WorldPay using Python? Specifically posting the XML order to WorldPay

1 Answer: 

It's an HTTP POST with Basic Authentication. Basic Authentication is described in the official Fetch Internet Resources Using urllib2 HOWTO. So, where XML is the XML you're sending, URL is the URL you're posting to, and MERCHANT_CODE and PASSWORD are self explanatory, the following works:

import urllib2
password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
password_mgr.add_password(None, URL, MERCHANT_CODE, PASSWORD)
handler = urllib2.HTTPBasicAuthHandler(password_mgr)
opener = urllib2.build_opener(handler)
request = Request(URL, XML, {'Content-Type': 'text/xml'})
response =, XML)

# do something with the response


More Articles

plugins - Magento community store have any EMI extensions?

I have searched a Magento extension for EMI options, but i didn't see any available extensions, if anyone knows any payment extensions including EMI please reply, or how to develop an EMI extension for magento? i am new in Magento family

How do I force my Google home to download latest version of the local app

I'm developing the smart device handler using Google Home Local SDK. How do I force device to reload and restart the app? (now I have to unplug the power cord, it does not looks good as it sparks)also I have a couple of Google Home devices, how do I tell which of them should execute requests, is it

Xcode: App installation failed No code signature found

I want run app on real device ( iphone 6 or 8 )But i get this error : App installation failed No code signature found.I try all below solutions but not work for me:iOS app testing. App installation failed. No code signature foundMy xcode version is 9.2I'm tired :(

Google Smart Home Action: Account linking successful, SYNC response sent by fulfillment with status code 200 but Google Home app reporting error

I am building a Google Smart Home action with fulfillment hosted on AWS as a lambda function in node.js with the node implementation for Google Smart Home actions, exposed via AWS API gateway and an external OAuth 2 provider serving as authorizer for API gateway. My fulfilment includes SYNC, QUERY a

payment processing - pylons/python

I'm building an application that eventually needs to process cc #s. I'd like to handle it completely in my app, and then hand off the information securely to my payment gateway. Ideally the user would have no interaction with the payment gateway directly.Any thoughts? Is there an easier way?

c# passing cookies as a parameter in sql

I am trying to save cookies on a login page pass it to another page where it will be used as a parameter in sql.saving cookies and redirecting to new page;HttpCookie cookie = new HttpCookie("UserID");cookie["UserID"] = reader["UserID"].ToString();Response.Cookies.Add(cookie);Response.Redirect("Home.

azure CloudBlobDirectory.ListBlobs() returns "The specified resource does not exist.", but fetchAttributes() works using same data

I am getting a "The specified resource does not exist" exception when I try to iterate the result of a ListBlobs() call. I can get the blob attributes when I access it directly, but I'm trying to get a list of all the blobs in the subdirectory.I wrote this little test to see exactly where the probl

IPN - PAYPAL No Return POST Data on Mobile

Many people are struggling with this one, when getting the return from PayPal there is no POST data if you use a mobile device (fine on desktop), so you can not run the IPN as there is no data to send.What do PayPal expect us to do, I have contacted PayPal support but they have not answered, this is

node.js - How to integrate Bpoint payment gateway in node js

I am new to node js. I want to integrate BPOINT payment gateway in my node js project. I have searched but did not get any result . Please help.

c# - Delete All Azure Table Records

I have an Azure Storage Table and it has 3k+ records. What is the most efficient way to delete all the rows in the table?