Send Payment Status

Once payment has been completed, you should inform us if the payment was successful. This is important to provide better analytics in identifying top areas of failure points. Payment status can be one of: SUCCESS, FAILURE or CANCELLED.

Among all the three techniques, sending the status from the server is the most reliable as the network between servers is much more robust.

From endUrlReached function

Since we always invoke endUrlReached method for all payment completions, you could send us the payment status at that point.

// Putting payment status
public BrowserCallback callBack = new BrowserCallback() {

  @Override
  public void ontransactionAborted() {
    // ...
  }

  @Override
  public void endUrlReached(String url) {
    GodelTracker.getInstance().trackPaymentStatus(transactionId, GodelTracker.PaymentStatus.SUCCESS);
    Toast.makeText(getApplicationContext(), "Transaction successful!", Toast.LENGTH_LONG).show();
  }

};

However, it may not always be possible to have the payment status at this point, especially if the aggregator uses HTTP POST for sending the payment details. In such cases, you can POST the status from the next activity or from your server.

From next activity

public class PaymentCompleteActivity {

  public void onCreated(Bundle savedInstanceState) {
    String transactionId = getTransactionIdOfCurrentPayment();
    String status = getPaymentStatusFromServer(transactionId);
    GodelTracker.getInstance().trackPaymentStatus(transactionId, GodelTracker.PaymentStatus.SUCCESS);
  }

}

From your Server

Payment status can also be sent from your servers. Please make sure that the following parameters are sent correctly along with the status:

  • client_id
  • merchant_id
  • order_id
  • transaction_id

Data must be sent as a properly formatted JSON. Example payload:

{
  "data":[
    {
      "merchant_id":"shop",
      "client_id":"shop_android",
      "order_id":"ord_112233",
      "transaction_id":"txn_112233",
      "payment_status":"SUCCESS"
    }
  ]
}

Payment status can be one of: SUCCESS, FAILURE or CANCELLED. Example HTTP POST to send payment status is provided below:

# Post status directly to Juspay server
curl https://logs.juspay.in/godel/analytics \
  -H 'Content-Type: application/json' \
  -d '{"data":[{"merchant_id":"shop", "client_id":"shop_android", "order_id":"ord_112233", "transaction_id": "txn_112233", "payment_status":"SUCCESS"}]}'

Note: This is the preferred method for sending Status to JusPay. Please send if Failure also. Otherwise, the transactions will be categorized as unknown.