Pluxee Card Integration
This section describes the parameters required to collect payments using the Pluxee card with Merchant Hosted Checkout integration (using _payment API) with a sample request and response.
Note:
Before you use the _payment API to collect a payment, it is recommended to use the Fetch Balance API (check_balance API) to check the Pluxee card balance and display it on the checkout page for the customer.
Steps to Integrate:
Before you begin:
Register for an account with PayU before you start integration. For more information, refer to Register for a Merchant Account.
Sodexo with Merchant Hosted Checkout Integration Workflow
The following describes the characteristics and workflow involved using Merchant Hosted Checkout with Pluxee:
- The existing _payment API used to initiate payments for online transactions will be used to initiate seamless payments for Pluxee payment option.
- For Sodexo payment option mode or PG is MC and Ibibo_code or bankcodeis SODEXO.
- In case customer provides the consent to save the card details with merchant on their check-out page:
- Merchant should pass save_sodexo_card parameter value as 1 when initiating the transaction using _payment API.
- After the transaction is processed and successful, for saved card transactions, Sodexo will share the sourceId with PayU and PayU will share this sourceId with merchant in the field3 parameter.
Note: Merchant is not allowed to store the complete card number or card expiry or card CVV details entered by the customer, even if customer provides permission to store the card.
- Merchant can also initiate transaction using source ID for repeat transactions where customer has provided permission to save the card during the first transaction. In this case, merchant should pass sourceId value in source_id parameter in the _payment API at the time of transaction initiation.
- In case source_id parameter is passed, PayU will directly initiate the transaction using this sourceId.
- Merchants are recommended to use the check_balance API for checking the Sodexo card balance. This will provide better experience to customers as available balance can be displayed up-front to customer and can have better SRT as scenarios where balance is less than transaction amount can be stopped at the checkout page itself.
Step 1: Post the payment request to PayU
Customers will select the Pluxee payment option on your website and enter the Pluxee card details and the amount will be based on the goods or services added to the cart.
Environment
Test Environment | <https://test.payu.in/_payment> |
Production Environment | <https://secure.payu.in/_payment> |
Post the following additional parameters for the Pluxee card integration.
Parameter | Description | Example |
---|---|---|
key
|
| |
txnid |
| |
amount |
| |
productinfo |
| |
firstname |
| Ashish |
email |
| |
phone |
| |
pg |
| MC |
bankcode |
| SODEXO |
ccnum |
| 5123456789012346 |
ccname |
| Ashish Kumar |
ccvv |
| 123 |
ccexpmon |
| 10 |
ccexpyr |
| 2021 |
save_sodexo_card | This parameter is used to specify the flag to save the Sodexo card along with the payment. Specify any of the following values:
| 1 |
source_id |
| |
is_check_balance |
| 1 |
furl |
| |
surl |
| |
hash |
| |
address1 |
| |
address2 |
| |
city |
| |
state |
| |
country |
| |
zipcode |
| |
udf1 |
| |
udf2 |
| |
udf3 |
| |
udf4 |
| |
udf5 |
|
PayU marks the transaction status based on the response received from the bank. PayU communicates the success URL to you if the payment is successful. Verify the authenticity of the hash value before accepting or rejecting the invoice order. For the list of parameters in the response body for the PayU Hosted integration, refer to Collect Payment API - Merchant Hosted Checkout under API Reference.
Sample request
curl -X \
POST "https://test.payu.in/_payment-H "accept: application/json" -H \
"Content-Type: application/x-www-form-urlencoded" -d”key=JP***g&txnid=bvRCCBO4YiGGHE&amount=10.00&firstname=Ashish&[email protected]&phone=9876543210&productinfo=iPhone&pg=MC&bankcode=SODEXO&surl=https://apiplayground-response.herokuapp.com/&furl=https://apiplayground-response.herokuapp.com/&ccnum=637513XXXXXX9318
&ccexpmon=05&ccexpyr=2022&ccvv=123&ccname=Ashish&hash=ad36b3253313753088c662053b043fbe6d7a10112b31fbf20c4b0945b6a70c3a12239c5330ec2d0a0956bcd28a689f08c94fbb9cc2c5e06bb08dc81968672f64”
/**
* PayU Pluxee Card Payment Integration using Fetch API
*
* IMPORTANT: This should only be executed server-side (e.g., in Node.js), never in the browser,
* as it contains sensitive payment information.
*/
// Payment endpoint
const url = 'https://test.payu.in/_payment';
// Form data parameters
const formData = new URLSearchParams();
formData.append('key', 'JP***g'); // Replace with your actual merchant key
formData.append('txnid', 'bvRCCBO4YiGGHE'); // Transaction ID (unique for each transaction)
formData.append('amount', '10.00'); // Payment amount
formData.append('firstname', 'Ashish'); // Customer's name
formData.append('email', '[email protected]'); // Customer's email
formData.append('phone', '9876543210'); // Customer's phone number
formData.append('productinfo', 'iPhone'); // Product information
formData.append('pg', 'MC'); // Payment gateway (MC for meal cards)
formData.append('bankcode', 'SODEXO'); // Specific card type (Sodexo/Pluxee)
formData.append('surl', 'https://apiplayground-response.herokuapp.com/'); // Success URL
formData.append('furl', 'https://apiplayground-response.herokuapp.com/'); // Failure URL
formData.append('ccnum', '637513XXXXXX9318'); // Card number
formData.append('ccexpmon', '05'); // Card expiry month
formData.append('ccexpyr', '2022'); // Card expiry year
formData.append('ccvv', '123'); // Card verification value
formData.append('ccname', 'Ashish'); // Cardholder name
formData.append('hash', 'ad36b3253313753088c662053b043fbe6d7a10112b31fbf20c4b0945b6a70c3a12239c5330ec2d0a0956bcd28a689f08c94fbb9cc2c5e06bb08dc81968672f64'); // Security hash
// Request options
const requestOptions = {
method: 'POST',
headers: {
'accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: formData
};
// Execute the request
fetch(url, requestOptions)
.then(response => {
console.log('Status Code:', response.status);
return response.text(); // or response.json() if you're sure it returns JSON
})
.then(data => {
console.log('Response:', data);
// Process payment response here
})
.catch(error => {
console.error('Error:', error);
});
import urllib.request
import urllib.parse
import json
from typing import Dict, Any
def process_pluxee_payment() -> Dict[str, Any]:
"""
Process Pluxee (Sodexo) card payment using PayU's Merchant Hosted Checkout
IMPORTANT: This is a server-side function. Never expose payment details to client-side code.
Returns:
Dictionary with response from PayU API
"""
# API endpoint
url = "https://test.payu.in/_payment"
# Prepare the form data
payload = {
"key": "JP***g", # Replace with your actual merchant key
"txnid": "bvRCCBO4YiGGHE", # Transaction ID (unique for each transaction)
"amount": "10.00", # Payment amount
"firstname": "Ashish", # Customer's name
"email": "[email protected]", # Customer's email
"phone": "9876543210", # Customer's phone number
"productinfo": "iPhone", # Product information
"pg": "MC", # Payment gateway (MC for meal cards)
"bankcode": "SODEXO", # Specific card type (Sodexo/Pluxee)
"surl": "https://apiplayground-response.herokuapp.com/", # Success URL
"furl": "https://apiplayground-response.herokuapp.com/", # Failure URL
"ccnum": "637513XXXXXX9318", # Card number
"ccexpmon": "05", # Card expiry month
"ccexpyr": "2022", # Card expiry year
"ccvv": "123", # Card verification value
"ccname": "Ashish", # Cardholder name
"hash": "ad36b3253313753088c662053b043fbe6d7a10112b31fbf20c4b0945b6a70c3a12239c5330ec2d0a0956bcd28a689f08c94fbb9cc2c5e06bb08dc81968672f64" # Security hash
}
# Convert dictionary to URL-encoded form data
data = urllib.parse.urlencode(payload).encode('utf-8')
# Set headers
headers = {
"accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded"
}
# Create a request object
req = urllib.request.Request(url, data=data, headers=headers, method="POST")
try:
# Send the request and get the response
with urllib.request.urlopen(req) as response:
response_data = response.read().decode('utf-8')
# Process and return response
return {
"status_code": response.getcode(),
"response": response_data
}
except urllib.error.HTTPError as e:
# Handle HTTP errors
error_data = e.read().decode('utf-8')
return {
"status_code": e.code,
"error": e.reason,
"response": error_data
}
except Exception as e:
# Handle other exceptions
return {
"status_code": 500,
"error": str(e),
"response": "An error occurred during payment processing"
}
# Example usage
if __name__ == "__main__":
result = process_pluxee_payment()
print(f"Status Code: {result['status_code']}")
if 'error' in result:
print(f"Error: {result['error']}")
print(f"Response: {result['response']}")
/**
* Process Pluxee (Sodexo) card payment using PayU's Merchant Hosted Checkout
*
* IMPORTANT: This is a server-side function. Never expose payment details to client-side code.
*
* @return array Response from PayU API
*/
function processPluxeeCardPayment() {
// API endpoint
$url = "https://test.payu.in/_payment";
// Prepare the form data
$payload = [
"key" => "JP***g", // Replace with your actual merchant key
"txnid" => "bvRCCBO4YiGGHE", // Transaction ID (unique for each transaction)
"amount" => "10.00", // Payment amount
"firstname" => "Ashish", // Customer's name
"email" => "[email protected]", // Customer's email
"phone" => "9876543210", // Customer's phone number
"productinfo" => "iPhone", // Product information
"pg" => "MC", // Payment gateway (MC for meal cards)
"bankcode" => "SODEXO", // Specific card type (Sodexo/Pluxee)
"surl" => "https://apiplayground-response.herokuapp.com/", // Success URL
"furl" => "https://apiplayground-response.herokuapp.com/", // Failure URL
"ccnum" => "637513XXXXXX9318", // Card number
"ccexpmon" => "05", // Card expiry month
"ccexpyr" => "2022", // Card expiry year
"ccvv" => "123", // Card verification value
"ccname" => "Ashish", // Cardholder name
"hash" => "ad36b3253313753088c662053b043fbe6d7a10112b31fbf20c4b0945b6a70c3a12239c5330ec2d0a0956bcd28a689f08c94fbb9cc2c5e06bb08dc81968672f64" // Security hash
];
// Initialize cURL session
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"accept: application/json",
"Content-Type: application/x-www-form-urlencoded"
]);
// For additional security in production
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
// Execute the request
$response = curl_exec($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
$errno = curl_errno($ch);
// Close cURL session
curl_close($ch);
// Handle response
if ($errno) {
return [
"status_code" => 500,
"error" => $error,
"response" => "cURL Error: " . $error
];
}
return [
"status_code" => $statusCode,
"response" => $response
];
}
// Example usage
$result = processPluxeeCardPayment();
echo "Status Code: " . $result["status_code"] . "\n";
if (isset($result["error"])) {
echo "Error: " . $result["error"] . "\n";
}
echo "Response: " . $result["response"] . "\n";
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.StringJoiner;
/**
* PayU Pluxee Card Payment Processor for Merchant Hosted Checkout
*
* IMPORTANT: This is a server-side implementation. Never expose payment details to client-side code.
*/
public class PayUPluxeeCardPaymentProcessor {
// API endpoint
private static final String PAYU_TEST_URL = "https://test.payu.in/_payment";
/**
* Process Pluxee card payment through PayU
* @return PaymentResponse containing status and response data
*/
public PaymentResponse processPluxeeCardPayment() {
try {
// Initialize URL
URL url = new URL(PAYU_TEST_URL);
// Prepare form parameters
Map<String, String> params = new HashMap<>();
params.put("key", "JP***g"); // Replace with your actual merchant key
params.put("txnid", "bvRCCBO4YiGGHE"); // Transaction ID (unique for each transaction)
params.put("amount", "10.00"); // Payment amount
params.put("firstname", "Ashish"); // Customer's name
params.put("email", "[email protected]"); // Customer's email
params.put("phone", "9876543210"); // Customer's phone number
params.put("productinfo", "iPhone"); // Product information
params.put("pg", "MC"); // Payment gateway (MC for meal cards)
params.put("bankcode", "SODEXO"); // Specific card type (Sodexo/Pluxee)
params.put("surl", "https://apiplayground-response.herokuapp.com/"); // Success URL
params.put("furl", "https://apiplayground-response.herokuapp.com/"); // Failure URL
params.put("ccnum", "637513XXXXXX9318"); // Card number
params.put("ccexpmon", "05"); // Card expiry month
params.put("ccexpyr", "2022"); // Card expiry year
params.put("ccvv", "123"); // Card verification value
params.put("ccname", "Ashish"); // Cardholder name
params.put("hash", "ad36b3253313753088c662053b043fbe6d7a10112b31fbf20c4b0945b6a70c3a12239c5330ec2d0a0956bcd28a689f08c94fbb9cc2c5e06bb08dc81968672f64"); // Security hash
// Convert parameters to URL-encoded form data
StringJoiner formData = new StringJoiner("&");
for (Map.Entry<String, String> entry : params.entrySet()) {
formData.add(URLEncoder.encode(entry.getKey(), "UTF-8") + "=" +
URLEncoder.encode(entry.getValue(), "UTF-8"));
}
byte[] postData = formData.toString().getBytes(StandardCharsets.UTF_8);
// Configure connection
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("accept", "application/json");
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
conn.setRequestProperty("Content-Length", String.valueOf(postData.length));
conn.setDoOutput(true);
conn.setConnectTimeout(5000);
conn.setReadTimeout(15000);
// Send request
try (DataOutputStream dos = new DataOutputStream(conn.getOutputStream())) {
dos.write(postData);
dos.flush();
}
// Get response
int responseCode = conn.getResponseCode();
// Read response data
StringBuilder response = new StringBuilder();
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(
responseCode >= 400 ? conn.getErrorStream() : conn.getInputStream(),
StandardCharsets.UTF_8))) {
String line;
while ((line = reader.readLine()) != null) {
response.append(line);
}
}
return new PaymentResponse(responseCode, response.toString(), null);
} catch (IOException e) {
// Handle exception
return new PaymentResponse(500, null, "Error: " + e.getMessage());
}
}
/**
* Payment response wrapper class
*/
public static class PaymentResponse {
private final int statusCode;
private final String response;
private final String error;
public PaymentResponse(int statusCode, String response, String error) {
this.statusCode = statusCode;
this.response = response;
this.error = error;
}
public int getStatusCode() {
return statusCode;
}
public String getResponse() {
return response;
}
public String getError() {
return error;
}
public boolean isSuccess() {
return statusCode >= 200 && statusCode < 300;
}
}
// Example usage
public static void main(String[] args) {
PayUPluxeeCardPaymentProcessor processor = new PayUPluxeeCardPaymentProcessor();
PaymentResponse result = processor.processPluxeeCardPayment();
System.out.println("Status Code: " + result.getStatusCode());
if (result.isSuccess()) {
System.out.println("Response: " + result.getResponse());
} else {
System.out.println("Error: " + result.getError());
}
}
}
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using System.Text;
namespace PayUPluxeeIntegration
{
/// <summary>
/// PayU Pluxee Card Payment Processor for Merchant Hosted Checkout
///
/// IMPORTANT: This is a server-side implementation. Never expose payment details to client-side code.
/// </summary>
public class PayUPluxeeCardPaymentProcessor
{
// API endpoint
private const string PayuTestUrl = "https://test.payu.in/_payment";
/// <summary>
/// Process Pluxee card payment through PayU
/// </summary>
/// <returns>PaymentResponse containing status and response data</returns>
public async Task<PaymentResponse> ProcessPluxeeCardPaymentAsync()
{
try
{
// Prepare form parameters
var formData = new Dictionary<string, string>
{
{ "key", "JP***g" }, // Replace with your actual merchant key
{ "txnid", "bvRCCBO4YiGGHE" }, // Transaction ID (unique for each transaction)
{ "amount", "10.00" }, // Payment amount
{ "firstname", "Ashish" }, // Customer's name
{ "email", "[email protected]" }, // Customer's email
{ "phone", "9876543210" }, // Customer's phone number
{ "productinfo", "iPhone" }, // Product information
{ "pg", "MC" }, // Payment gateway (MC for meal cards)
{ "bankcode", "SODEXO" }, // Specific card type (Sodexo/Pluxee)
{ "surl", "https://apiplayground-response.herokuapp.com/" }, // Success URL
{ "furl", "https://apiplayground-response.herokuapp.com/" }, // Failure URL
{ "ccnum", "637513XXXXXX9318" }, // Card number
{ "ccexpmon", "05" }, // Card expiry month
{ "ccexpyr", "2022" }, // Card expiry year
{ "ccvv", "123" }, // Card verification value
{ "ccname", "Ashish" }, // Cardholder name
{ "hash", "ad36b3253313753088c662053b043fbe6d7a10112b31fbf20c4b0945b6a70c3a12239c5330ec2d0a0956bcd28a689f08c94fbb9cc2c5e06bb08dc81968672f64" } // Security hash
};
// Create HttpClient with timeout
using (var httpClient = new HttpClient())
{
httpClient.Timeout = TimeSpan.FromSeconds(30);
// Convert form data to content
var content = new FormUrlEncodedContent(formData);
// Add headers
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/x-www-form-urlencoded");
httpClient.DefaultRequestHeaders.Add("accept", "application/json");
// Send POST request
var response = await httpClient.PostAsync(PayuTestUrl, content);
// Get response content
var responseContent = await response.Content.ReadAsStringAsync();
return new PaymentResponse(
(int)response.StatusCode,
responseContent,
null
);
}
}
catch (Exception ex)
{
// Handle exception
return new PaymentResponse(
500,
null,
$"Error: {ex.Message}"
);
}
}
/// <summary>
/// Payment response wrapper class
/// </summary>
public class PaymentResponse
{
public int StatusCode { get; }
public string Response { get; }
public string Error { get; }
public PaymentResponse(int statusCode, string response, string error)
{
StatusCode = statusCode;
Response = response;
Error = error;
}
public bool IsSuccess => StatusCode >= 200 && StatusCode < 300;
}
}
// Example usage
class Program
{
static async Task Main(string[] args)
{
var processor = new PayUPluxeeCardPaymentProcessor();
var result = await processor.ProcessPluxeeCardPaymentAsync();
Console.WriteLine($"Status Code: {result.StatusCode}");
if (result.IsSuccess)
{
Console.WriteLine($"Response: {result.Response}");
}
else
{
Console.WriteLine($"Error: {result.Error}");
}
}
}
}
Hashing
You must hash the request parameters using the following hash logic:
sha512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||SALT)
For more information, refer to Generate Hash.
Step 2: Check response from PayU
Hash validation logic for payment response (Reverse Hashing)
While sending the response, PayU takes the exact same parameters that were sent in the request (in reverse order) to calculate the hash and returns it to you. You must verify the hash and then mark a transaction as a success or failure. This is to make sure the transaction has not tampered within the response.
The order of the parameters is similar to the following code block:
sha512(SALT|status||||||udf5|udf4|udf3|udf2|udf1|email|firstname|productinfo|amount|txnid|key)
Sample response (parsed)
Array
(
[mihpayid] => 403993715524069222
[mode] => MC
[status] => success
[unmappedstatus] => captured
[key] => JF***g
[txnid] => EaE4ZO3vU4iPsp
[amount] => 10.00
[cardCategory] => domestic
[discount] => 0.00
[net_amount_debit] => 10
[addedon] => 2022-10-08 19:37:19
[productinfo] => iPhone
[firstname] => Ashish
[lastname] =>
[address1] =>
[address2] =>
[city] =>
[state] =>
[country] =>
[zipcode] =>
[email] => [email protected]
[phone] => 9876543210
[udf1] =>
[udf2] =>
[udf3] =>
[udf4] =>
[udf5] =>
[udf6] =>
[udf7] =>
[udf8] =>
[udf9] =>
[udf10] =>
[hash] => ed99957adb08fea56c907b88e8d158a79c3562c67f96c298461509826f77a7ae9e88b2a176b3234c25f50bcd451271728719656f3bb59c13a52bebabc468615a
[field1] => 0608273386032718000015
[field2] => 986987
[field3] => 10.00
[field4] => 403993715524069222
[field5] => 100
[field6] => 02
[field7] => AUTHPOSITIVE
[field8] =>
[field9] => Transaction is Successful
[payment_source] => payu
[PG_TYPE] => MC-PG
[bank_ref_num] => 0608273386032718000015
[bankcode] => SODEXO
[error] => E000
[error_Message] => No Error
[name_on_card] => Ashish
[cardnum] => 637513XXXXXX3104
[cardhash] => This field is no longer supported in postback params.
)
Step 3: Verify the Payment
Verify the transaction details using the Verification APIs. For more information, refer to Verify Payment API under API Reference.
Note:
The transaction ID that you posted in Step 1 with PayU must be used here.
Updated 20 days ago