search

Payment

 

CreateTxnToken


Returns a token which will be used in further frontend payment calls.

createTxnToken(paymentDetails)
Example
EChannelId channelId = EChannelId.WEB;
String orderId = "UNIQUE_ORDER_ID";
Money txnAmount = new Money(EnumCurrency.INR, "1.00");
UserInfo userInfo = new UserInfo();
userInfo.setCustId("CUSTOMER_ID");
PaymentDetail paymentDetails = new PaymentDetail.PaymentDetailBuilder
                (channelId, orderId, txnAmount, userInfo).build();
SDKResponse<InitiateTransactionResponse> response = Payment.createTxnToken(paymentDetails);
var channelId = Paytm.EChannelId.WEB;
var orderId = "UNIQUE_ORDER_ID";
var txnAmount = Paytm.Money.constructWithCurrencyAndValue(Paytm.EnumCurrency.INR, "1.00");
var userInfo = new Paytm.UserInfo("CUSTOMER_ID"); 
userInfo.setAddress("CUSTOMER_ADDRESS");
userInfo.setEmail("CUSTOMER_EMAIL_ID");
userInfo.setFirstName("CUSTOMER_FIRST_NAME");
userInfo.setLastName("CUSTOMER_LAST_NAME");
userInfo.setMobile("CUSTOMER_MOBILE_NO");
userInfo.setPincode("CUSTOMER_PINCODE");
var paymentDetailBuilder = new Paytm.PaymentDetailBuilder(channelId, orderId, txnAmount, userInfo);
var paymentDetail = paymentDetailBuilder.build();
var response = Paytm.Payment.createTxnToken(paymentDetail);
$channelId = EChannelId::WEB;
$orderId = "UNIQUE_ORDER_ID";
$txnAmount = Money::constructWithCurrencyAndValue(EnumCurrency::INR, "1.00");
$userInfo = new UserInfo("CUSTOMER_ID"); 
$userInfo->setAddress("CUSTOMER_ADDRESS");
$userInfo->setEmail("CUSTOMER_EMAIL_ID");
$userInfo->setFirstName("CUSTOMER_FIRST_NAME");
$userInfo->setLastName("CUSTOMER_LAST_NAME");
$userInfo->setMobile("CUSTOMER_MOBILE_NO");
$userInfo->setPincode("CUSTOMER_PINCODE");
$paymentDetailBuilder = new PaymentDetailBuilder($channelId, $orderId, $txnAmount, $userInfo);
$paymentDetail = $paymentDetailBuilder->build();
$response = Payment::createTxnToken($paymentDetail);
EChannelId channel_id = EChannelId.WEB
order_id = "UNIQUE_ORDER_ID"
txn_amount = Money(EnumCurrency.INR, "1.00")
user_info = UserInfo()
user_info.set_cust_id("CUSTOMER_ID")
user_info.set_address("CUSTOMER_ADDRESS")
user_info.set_email("CUSTOMER_EMAIL_ID")
user_info.set_first_name("CUSTOMER_FIRST_NAME")
user_info.set_last_name("CUSTOMER_LAST_NAME")
user_info.set_mobile("CUSTOMER_MOBILE_NO")
user_info.set_pincode("CUSTOMER_PINCODE")
payment_details = PaymentDetailsBuilder(channel_id, order_id, txn_amount, user_info).build()
response = Payment.createTxnToken(payment_details)
 

GetPaymentStatus


Returns the payment status

getPaymentStatus(paymentStatusDetail)
Example
String orderId = "YOUR_ORDER_ID";
Time readTimeout = new Time(5, TimeUnit.MINUTES);
PaymentStatusDetail paymentStatusDetail = new PaymentStatusDetail.PaymentStatusDetailBuilder(orderId).setReadTimeout(readTimeout).build();
SDKResponse<NativePaymentStatusResponse> response = Payment.getPaymentStatus(paymentStatusDetail);
var orderId = "YOUR_ORDER_ID";
var readTimeout = 80000;
var paymentStatusDetailBuilder = new Paytm.PaymentStatusDetailBuilder(orderId);
var paymentStatusDetail = paymentStatusDetailBuilder.setReadTimeout(readTimeout).build();
var response = Paytm.Payment.getPaymentStatus(paymentStatusDetail);
$orderId = "YOUR_ORDER_ID";
$readTimeout = 80000;
$paymentStatusDetailBuilder = new PaymentStatusDetailBuilder($orderId);
$paymentStatusDetail = $paymentStatusDetailBuilder->setReadTimeout($readTimeout)->build();
$response = Payment::getPaymentStatus($paymentStatusDetail);
order_id = "YOUR_ORDER_ID"
read_timeout = 30*1000
payment_status_detail = PaymentStatusDetailBuilder(order_id).set_read_timeout(read_timeout).build()
response = Payment.get_payment_status(payment_status_detail)

Refund

 

InitiateRefund


Initiates the Refund

initiateRefund(refundDetail)
Example
String orderId = "UNIQUE_ORDER_ID";
String refId = "REFERENCE_ID";
String txnId = "TRANSACTION_ID";
String txnType = "REFUND";
String refundAmount = "1";
Time readTimeout = new Time(5, TimeUnit.MINUTES);
RefundDetail refundDetail = new RefundDetail.RefundDetailBuilder(orderId, refId, txnId, txnType,refundAmount).setReadTimeout(readTimeout).build();
SDKResponse<AsyncRefundResponse>response = Refund.initiateRefund(refundDetail);
String orderId = "UNIQUE_ORDER_ID";
String refId = "REFERENCE_ID";
String txnId = "TRANSACTION_ID";
String txnType = "REFUND";
String refundAmount = "1";
Time readTimeout = new Time(5, TimeUnit.MINUTES);
RefundDetail refundDetail = new RefundDetail.RefundDetailBuilder(orderId, refId, txnId, txnType,refundAmount).setReadTimeout(readTimeout).build();
SDKResponse<AsyncRefundResponse>response = Refund.initiateRefund(refundDetail);
$orderId = "UNIQUE_ORDER_ID";
$refId = "REFERENCE_ID";
$txnId = "TRANSACTION_ID";
$txnType = "REFUND";
$refundAmount = "1";
$readTimeout = 80000;
$subWalletAmount = array();
$subWalletAmount[UserSubWalletType::FOOD] = 1.00;
$subWalletAmount[UserSubWalletType::GIFT] = 1.00;
$refund = new RefundDetailBuilder($orderId, 
        $refId, $txnId, $txnType, $refundAmount);
$refundDetail = $refund->setReadTimeout($readTimeout)
->setSubwalletAmount($subWalletAmount)
->build();
$response = Refund::initiateRefund($refundDetail);
order_id = "UNIQUE_ORDER_ID"
ref_id = "REFERENCE_ID"
txn_id = "TRANSACTION_ID"
txn_type = "REFUND"
refund_amount = "1"
refund = RefundDetailBuilder(order_id, ref_id, txn_id, txn_type, refund_amount)
            .set_sub_wallet_amount(SampleData.get_sub_wallet_amount())
            .set_extra_params_map(SampleData.get_extra_params_map()).build()
response = Refund.do_refund(refund)
Parameters
ATTRIBUTE DESCRIPTION
RefundDetail Consists of all refund attributes like orderId, refId, txnType, refundAmount, etc.

 

Return type
ATTRIBUTE DESCRIPTION
SDKResponse Consists of AsyncRefundResponse object and raw json response string.

 

GetRefundStatus


Returns the Refund status

getRefundStatus(refundStatusDetail)
Example
String orderId = "ORDER_ID";
String refId = "REFERENCE_ID";
Time readTimeout = new Time(5, TimeUnit.MINUTES);
RefundStatusDetail refundStatusDetail = new RefundStatusDetail.RefundStatusDetailBuilder(orderId, refId)
                    .setReadTimeout(readTimeout).build();
SDKResponse<NativeRefundStatusResponse> response = Refund.getRefundStatus(refundStatusDetail);
var orderId = "ORDER_ID";
var refId = "REFERENCE_ID";
var readTimeout = 8000;
var refundStatusDetailBuilder = new Paytm.RefundStatusDetailBuilder(orderId, refId);
var refundStatusDetail = refundStatusDetailBuilder.setReadTimeout(readTimeout).build();
var response = Paytm.Refund.getRefundStatus(refundStatusDetail);
$orderId = "ORDERID";
$refId = "REFERENCE_ID";
$readTimeout = 8000;
$refundStatusDetailBuilder = new RefundStatusDetailBuilder($orderId, $refId);
$refundStatusDetail = $refundStatusDetailBuilder->setReadTimeout($readTimeout)->build();
$response = Refund::getRefundStatus($refundStatusDetail);
order_id = "ORDER_ID";
ref_id = "REFERENCE_ID"
refund_status_details = RefundStatusDetailBuilder().set_order_id(order_id).set_ref_id(ref_id).build()
response = Refund.get_refund_status(refund_status_details)