Use the v2 Get User Cards API to get the card details of a customer.
📘
Note: While PayU token is sent in payment response, the network/issuer token creation may fail. In this case, the subsequent transaction with the said PayU token may fail. Merchant can do a get_user_cards API to fetch only active/tokenized cards or listen to notification API (to be published) to maintain state at your end.
The Get User Cards API is used to fetch all the cards for a customer which were saved earlier. In this API, the card number and other sensitive information are not returned.
HTTP Method: POST
Request Header
Authentication header
Parameter
Description
date
The current date and time. For example, format of the date is Wed, 28 Jun 2023 11:25:19 GMT.
authorization
The actual HMAC signature generated using the specified algorithm (sha512) and includes the hashed data. For more information, refer to authorization fields description table below.
authorization fields description
Parameter
Description
username
Represents the username or identifier for the client or merchant, in this case, it's "smsplus".
algorithm
Use SHA512 algorithm for hashing and send this as header value.
headers
Specifies which headers have been used in generating the hash. In this case, only the "date" header is used.
signature
The actual HMAC signature generated using the specified algorithm (sha512) and includes the hashed data. For more information, refer to hashing algorithm.
hashing algorithm
You must hash the request parameters using the following hash logic:
sha512(<Body data> + '|' + date + '|' + merchant_secret}
Where, <Body data> contains the request Body posted with the request.
Sample authorization header code
var merchant_key = pm.environment.get('merchantKey') || 'PRiQvJ';
var merchant_secret = pm.environment.get('merchantSalt') || 'mGHSxpD2iBVywParGQrGBlaXjnwkGJMQ';
// Generate current date in RFC 1123 format
var date = new Date().toUTCString();
// Get request body data (empty for GET/DELETE)
var data = "";
if (pm.request.method === "POST" && pm.request.body && pm.request.body.raw) {
data = pm.request.body.raw;
}
// Generate authorization header
var hash_string = data + '|' + date + '|' + merchant_secret;
var hash = CryptoJS.SHA512(hash_string).toString(CryptoJS.enc.Hex);
var authorization = 'hmac username="' + merchant_key + '", algorithm="sha512", headers="date", signature="' + hash + '"';
// Set environment variables
pm.environment.set('date', date);
pm.environment.set('authorization', authorization);
Query parameter
Parameter
Description
Example
userCredential mandatory
String User authentication credential in the format username:userid.
testuser:testuser123
getSoftDeleted optional
Integer Flag to include soft-deleted records in the response. Set to 1 to include, 0 to exclude.
1
Header parameters
Parameter
Description
mid mandatory
Merchant ID provided by PayU. Use the value provided in your PayU dashboard.