DocumentationRecipesAPI ReferenceChangelog
Documentation

Retrieve payment options (Optional)

The Payment Options API is for retrieve merchant details, transaction details and enabled payment options based on merchant account’s configuration.

 
Here are 3 steps to retrieve payment options:


Step 1: Get payment token.

📘

Payment Token API

Please refer: Full sample code

String paymentToken = "roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL";
let paymentToken:String = "roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL"
NSString *paymentToken = @"roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL";

Step 2: Construct payment option request.

PaymentOptionRequest paymentOptionRequest = new PaymentOptionRequest();
   paymentOptionRequest.setPaymentToken(paymentToken);
let paymentOptionRequest:PaymentOptionRequest = PaymentOptionRequest()
   paymentOptionRequest.paymentToken = paymentToken
PaymentOptionRequest *paymentOptionRequest = [[PaymentOptionRequest alloc] init];
   paymentOptionRequest.paymentToken = paymentToken;

Step 3: Retrieve payment options.\

 
Based on these information merchant can build their own transaction details and payment options layout.

PGWSDK.getInstance().paymentOption(paymentOptionRequest, new PaymentOptionCallback() {
    
      @Override
      public void onResponse(PaymentOptionResponse response) {
          
         if(response.getResponseCode().equals(APIResponseCode.API_SUCCESS)) {
               
            ArrayList<Channel> channels = response.getChannels();
              
            for(Channel channel : channels) {  
               String name = channel.getName();
               String iconUrl = channel.getIconUrl();
               String paymentChannel = channel.getPaymentChannel();
            }
         } else {
            //Get error response and display error
         }
      }
    
      @Override
      public void onFailure(Throwable error) {
         //Get error response and display error
      }
   });
PGWSDK.shared.paymentOption(paymentOptionRequest: paymentOptionRequest, 
                               success: { (response:PaymentOptionResponse) in
                               
      if response.responseCode == APIResponseCode.API_SUCCESS {
      
         let channels:[Channel] = response.channels
                
         for channel:Channel in channels {
            let name:String = channel.name
            let iconUrl:String = channel.iconUrl
            let paymentChannel:String = channel.paymentChannel()
         }
      } else {
         //Get error response and display error
      }
   }) { (error:NSError) in
      //Get error response and display error
   }
[[PGWSDK shared] paymentOptionWithPaymentOptionRequest:paymentOptionRequest 
                    success:^(PaymentOptionResponse * _Nonnull response) {
     
      if ([response.responseCode isEqualToString:APIResponseCode.API_SUCCESS]) {
        
         NSArray<Channel *> *channels = response.channels;
            
         for (Channel *channel in channels) {
            NSString *name = channel.name;
            NSString *iconUrl = channel.iconUrl;
            NSString *paymentChannel = channel.paymentChannel;
         }
      } else {
         //Get error response and display error
      }
   } failure:^(NSError * _Nonnull error) {
      //Get error response and display error
   }];

Complete Code:
 
Copy & Paste below source code into your application.

String paymentToken = "roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL";

   //Construct payment option request
   PaymentOptionRequest paymentOptionRequest = new PaymentOptionRequest();
   paymentOptionRequest.setPaymentToken(paymentToken);

   //Retrieve payment options
   PGWSDK.getInstance().paymentOption(paymentOptionRequest, new PaymentOptionCallback() {
    
      @Override
      public void onResponse(PaymentOptionResponse response) {
          
         if(response.getResponseCode().equals(APIResponseCode.API_SUCCESS)) {
               
            ArrayList<Channel> channels = response.getChannels();
              
            for(Channel channel : channels) {  
               String name = channel.getName();
               String iconUrl = channel.getIconUrl();
               String paymentChannel = channel.getPaymentChannel();
            }
         } else {
            //Get error response and display error
         }
      }
    
      @Override
      public void onFailure(Throwable error) {
         //Get error response and display error
      }
   });
let paymentToken:String = "roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL"
   
   //Construct payment option request
   let paymentOptionRequest:PaymentOptionRequest = PaymentOptionRequest()
   paymentOptionRequest.paymentToken = paymentToken

   //Retrieve payment options
   PGWSDK.shared.paymentOption(paymentOptionRequest: paymentOptionRequest, 
                               success: { (response:PaymentOptionResponse) in
                               
      if response.responseCode == APIResponseCode.API_SUCCESS {
      
         let channels:[Channel] = response.channels
                
         for channel:Channel in channels {
            let name:String = channel.name
            let iconUrl:String = channel.iconUrl
            let paymentChannel:String = channel.paymentChannel()
         }
      } else {
         //Get error response and display error
      }
   }) { (error:NSError) in
      //Get error response and display error
   }
NSString *paymentToken = @"roZG9I1hk/GYjNt+BYPYbxQtKElbZDs9M5cXuEbE+Z0QTr/yUcl1oG7t0AGoOJlBhzeyBtf5mQi1UqGbjC66E85S4m63CfV/awwNbbLbkxsvfgzn0KSv7JzH3gcs/OIL";

   //Construct payment option request
   PaymentOptionRequest *paymentOptionRequest = [[PaymentOptionRequest alloc] init];
   paymentOptionRequest.paymentToken = paymentToken;

   //Retrieve payment options
   [[PGWSDK shared] paymentOptionWithPaymentOptionRequest:paymentOptionRequest 
                    success:^(PaymentOptionResponse * _Nonnull response) {
     
      if ([response.responseCode isEqualToString:APIResponseCode.API_SUCCESS]) {
        
         NSArray<Channel *> *channels = response.channels;
            
         for (Channel *channel in channels) {
            NSString *name = channel.name;
            NSString *iconUrl = channel.iconUrl;
            NSString *paymentChannel = channel.paymentChannel;
         }
      } else {
         //Get error response and display error
      }
   } failure:^(NSError * _Nonnull error) {
      //Get error response and display error
   }];

Next: Retrieve Payment Option Details (Optional)