Recurring Payment Request (Non-UI)
To request recurring payment , you need to init the property like below
- (void)payment
{
//set mandatory fields
paymentSDK.merchantID = @"JT01";
paymentSDK.uniqueTransactionCode = @"123456789";
paymentSDK.desc = @"product item 1";
paymentSDK.amount = 20.00;
paymentSDK.currencyCode = @"764";
paymentSDK.pan = @"5105105105105100";
paymentSDK.cardExpireMonth = 12;
paymentSDK.cardExpireYear = 2019;
paymentSDK.cardHolderName = @"Mr. John";
paymentSDK.panCountry = @"TH";
paymentSDK.secretKey = @"123456";
paymentSDK.paymentUI = NO;
//mandatory only if recurring is set to true
paymentSDK.recurring = YES;
paymentSDK.invoicePrefix = @"pre";
paymentSDK.recurringInterval = 7; //below 365
paymentSDK.recurringCount = 3;
paymentSDK.recurringAmount = 20.00;
//mandatory only if allowAccumulate is set to true
paymentSDK.allowAccumulate = YES;
paymentSDK.maxAccumulateAmt = 100.00;
//set optional fields
paymentSDK.securityCode = @"123";
[paymentSDK requestWithTarget:self onResponse:^(NSDictionary *response)
{
NSLog(@"%@",response);
if([response[@"respCode"] isEqualToString:@"00"])
{
message = @"Payment Success";
}
else {
message = response[@"failReason"];
}
NSLog(@"Payment status: %@",message);
} onFail:^(NSError *error) {
if(error) {
NSLog(@"%@",error);
}
else {
NSLog(@"Cancel The Payment From OTP");
}
}];
}
func payment() {
//set mandatory fields
paymentSDK.merchantID = "JT01"
paymentSDK.uniqueTransactionCode = "123456789"
paymentSDK.desc = "product item 1"
paymentSDK.amount = 20.00
paymentSDK.currencyCode = "764"
paymentSDK.pan = "5105105105105100"
paymentSDK.cardExpireMonth = 12
paymentSDK.cardExpireYear = 2019
paymentSDK.cardHolderName = "Mr. John"
paymentSDK.panCountry = "TH"
paymentSDK.secretKey = "123456"
paymentSDK.paymentUI = false
//mandatory only if recurring is set to true
paymentSDK.recurring = true
paymentSDK.invoicePrefix = "pre"
paymentSDK.recurringInterval = 7 //below 365
paymentSDK.recurringCount = 3
paymentSDK.recurringAmount = 20.00
//mandatory only if allowAccumulate is set to true
paymentSDK.allowAccumulate = true
paymentSDK.maxAccumulateAmt = 100.00
//set optional fields
paymentSDK.securityCode = "123"
paymentSDK.request(withTarget: self, onResponse: { (response) in
print("response: \(String(describing: response))")
}) { (error) in
if error != nil {
print("error: \(String(describing: error?.localizedDescription))")
}else{
print("user cancel payment")
}
}
}
Check the full Payment Request example and response at Response Dictionary.