Store Card- iOS – PayU Documentation

Store card- iOS

Pre-requisites

  • PayU’s SDK
  • Test Key and salt
  • Live Key and salt

Steps Involved

  1. To store a new card, you need to provide a checkbox in your payment page UI and post us the corresponding parameters.
  2. To use an already stored card, you need to fetch all the previously stored cards via an API and post us the parameters.
  3. Deleting a stored card.

To store a new card

 

UI change

 

In CC/DC screen, create a checkbox, which should ask user to save the card details. (Refer sample app for more details)

 

Make payment

 

To facilitate a customer to enroll a  credit/ debit card to store card, you are required to make some changes in your code. Also, you are required to post two extra parameters to PayU compared to the otherwise existing flow of CC/DC.

Parameters to be posted:

Parameter Description Value
userCredentials Used to identify each unique user, to show the option of saving a card, on payment page. <merchant_key:unique_customer_identifier>

merchant_key: Unique merchant key provided by payu.

unique_customer_identifier: unique value to identify a customer, be it email id, phone or any unique string

Please note both variables are separated by a ‘:’

storeCardName For setting a nickname/ custom label to the card Some string value should be there either empty string or card name. If you dont want to save a card than make it nil

Examples of user_credentials:

If the merchant_key is JBiPgT, then examples of user_credentials are as below:

  1. a) JBiPgT:test@example.com – [Email ID used here]
  2. b) JBiPgT:9999999999 – [Phone number used]
  3. c) JBiPgT:123456 – [Numeric Value]
  4. d) JBiPgT:ertyui12fgh5jasas – [String used]

Code of line that needs to be added:

The complete sample code form with all the parameters required to  convert a CC/ DC card to store Card will be as follows

Response

 

Once all these parameters are passed and a successful transaction is carried out, the card would be saved in PayU’s database and you would receive a card token in the response, which you are required to store at your end.

Once the payment is successful, SDK will give callback in “PayUSuccessResponse:” method. The response comes in key value pair.

Using an already stored card for payment

 

Fetching stored cards from PayU

 

You are required to fetch all the store cards from PayU for a customer to choose one of the store cards to make payment. You have to do this by calling our API payment_related_details_for_mobile_sdk.

To use payment_related_details_for_mobile_sdk:

POST

In order to retrieve all the store cards, you need to make a server to server call on the following URL with certain parameters:

Environment URL
Test https://test.payu.in/merchant/postservice.php?form=1
Live https://info.payu.in/merchant/postservice.php?form=1

Parameters:

Parameter Value Description Sample value
key Your key provided by payu gtKFFx
command Name of web service call payment_related_details_for_mobile_sdk
hash Security parameter e54de882e2b14c13424c91a4855fea2dc9b2a3a9525531408beec97564dd336460e22d72770ba37a5fcb6bad76d042582e87cc26b34741b6b6747e6b5b71b2cc
var1 user_credentials Identification parameter of customer gtKFFx:payutest@payu.in

You would need to send all the parameters in the following mentioned format

 

Response

 

This response gives a list of all the stored cards

 

Making a POST request

 

When all stored cards pertaining to a user are returned and user chooses one of those to make a payment,you are required  to post set of following parameters instead of sending the usual parameters for a CC/DC transaction.

Parameter Replacement param Description Example
ccnum card_token  Encoded String to identify unique stored card
ccname user_credentails  Merchant’s user credentials  username;password
ccexpmon
ccexpyr

Now the form has to be submitted to PayU’s SDK, the sample code is as follows

Deleting a Card

 

In order to delete a card, you would need to implement the following code

Still have questions?

Our team will be more than happy to help you. You can reach out to them at tech@payu.in