The SOAP header
Each server to server SOAP call to PayU's API will require a SOAP header with a username and password defined. The SOAP header serves to provide an extra layer of security forto the merchant's transaction.
An example of a PayU SOAP header XML is:
<wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <wsse:UsernameToken wsu:Id="UsernameToken-9" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <wsse:Username>PayU provided SOAP username</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PayU provided SOAP password</wsse:Password> </wsse:UsernameToken> </wsse:Security> |
---|
setTransaction API Call
The setTransaction API call is used setup/initiate transactions between the merchant and PayU using server to server requests before paying on the PayU payment page. In doing this minimal detail about a transaction goes over HTTP POST or GET requests.
After doing a successful setTransaction request, a PayU reference number is issued in response. This reference number is used to do the payment against when the customer's browser redirects to PayU's payment page. Append this parameter and its value need to the the RPP URL and the customer's browser redirect the customer to the URL e.g.:
https://secure.payu.co.za/rpp.do?PayUReference=123456789
- Transaction Types
The transaction type parameter in the setTransaction call is used to identify what type of transaction will be done.
All transaction type parameter values as listed in the pack's included file, PayU Advanced RPP V1.x.pdf, but two are typically used - PAYMENT or RESERVE. Each of these transaction types has a different effect transaction's authorisation and settle components, which are explained below.
RESERVE transaction type
This transaction type is typically used when a merchant issues shippable goods or get stock from a supplier.
Scenario:
Once a customer does a successful payment on the PayU interface, the funds are authorised. The merchant will try and source the goods from its supplier. Once the merchant has received the stock and ready to ship, the merchant will issue a settle on the funds and ship the goods.
A typical payment sequence for the RESERVE transaction type: 1. Do a setTransaction SOAP call against PayU API on merchant's website The following is typically done once the merchant is in possession of the shippable goods |
---|
PAYMENT transaction type
The PAYMENT transaction type is typically used in transactions when stock is immediately available e.g. an mp3 download or online tickets.
Scenario:
Once a customer does a successful payment on the PayU interface, the funds are authorised and settled. The merchant now gives the customer access to the goods e.g. mp3 download link
A typical payment sequence for the PAYMENT transaction type: |
---|
getTransaction API Call
The getTransaction SOAP call is typically used to retrieve information on the state of the transaction for the specified PayU reference number using server to server requests between the merchant website and PayU. In doing this minimal detail about a transaction goes over HTTP POST or GET request methods. This call is typically done on the merchant website after the redirect back from the PayU payment page to find out if the customer's payment was successful or not.
More technical detail for the getTransaction call is provided in the pack's included file, PayU Advanced RPP Vx.x.pdf.
doTransaction API Call
The doTransaction SOAP call is used to action a type of transaction defined by the value in the transaction type parameter against a specified the PayU reference number.
If the setTransaction call sent through a transaction type that requires a follow up (RESERVE → FINALISE) then a doTransaction call needs to be done in order to complete the transaction.
Additionally, a doTransaction call can be done in order to CREDIT a PAYMENT done in the setTransaction.
In the case of a doTransaction for a FINALIZE. The transaction will go almost immediately from the NEW state to PROCESSING when PayU go off to the payment gateway to perform the payment. Upon receiving the response from the payment gateway the state is changed to SUCCESSFUL or FAILED.