1. Home
  2. Docs
  3. API Documentation
  4. Active APIs
  5. complete_txn

complete_txn

This API stops the execution of the automation steps of a transaction and marks it as completed.

Consider the following automation example where a customer registers to your application:

1. Upon successful registration, the new customer is sent an email with a link to activate his account.

2. If the customer does not click on the link within a certain amount of time, then the client should be sent a reminder email to activate his account.

However, if a customer clicks on the link to activate his account in your application, you need to let Juvlon know to not execute the remaining steps of the defined automation workflow (like sending out the reminder email, etc.). This is accomplished by the “complete_txn” API which will mark the transaction as completed, and stop the execution of the remaining steps of the automation for this transaction (for this customer).

URL: https://api2.juvlon.com/v4/complete_txn

JSON Parameters
'{"ApiKey":"$ApiKey",
    "TransactionID":"$TransactionID",
    "StepID":"$StepID"
}';

Arguments

NameTypeDescriptionDefault
apikeyString(Mandatory) The ApiKey is a unique key generated for your account that authenticates you and helps us to identify your Juvlon account. 
TransactionIDString(Mandatory) A number generated by the start_txn API to uniquely identify and track the current transaction. If a TransactionID is provided, this transaction is marked completed. The email address and mobile number fields are ignored. 
StepIDString(Mandatory) The ID of the step for starting the transaction in the automation workflow that you want to execute. 

Return value

TypeDescription
CodeThe Success or Error code as per the result of executing this API call. Please refer to the section “Possible-Response-Codes” for more details. 
Status“Success” or “Error” text. 
TransactionIDThe same transaction ID that was passed in the call. 

Usage / Example(s)

PHP Example Code for Integration

$url = 'https://api2.juvlon.com/v4/complete_txn'; 
$data = '{"ApiKey":"KEY",
            "TransactionID":"126894",
            "StepID":"5"
}';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$res1 = curl_exec($ch);
curl_close($ch);

Success-Response

HTTP/1.1
{
    "code":200,
    "status":"Success",
    "TransactionID":"126894"  
}

Error-Response

HTTP/1.1
{
    "code":403,
    "status":"Error: Unauthorized/Invalid Key",
    "TransactionID":"327"   
} 

Possible-Response-Codes

200    Success: API Request Accepted
401    Error: Invalid Method
402    Error: Unauthorized/Empty Key
403    Error: Unauthorized/Invalid Key
404    Error: Account Sending Blocked
405    Error: Your Juvlon account has expired