Server Side Integration

Server side implementation required at Merchant end (to integrate with Juspay Payments SDK) will need ensuring:
To ensure integration with the Juspay Payments SDK from the server side (Merchant end), the following three items/operations are required:
  1. Availability of all payload parameters to trigger Payments SDK (Refer Step 2 & 4 in Integration Architecture )
  2. Handling SDK responses (Refer Step 6 in Integration Architecture )
  3. Implementation of Server-to-Server calls

I. Availability of all payload parameters to trigger Payments SDK

The Merchant App will need specific payload to Initiate and Process the SDK. Please ensure that all the payload parameters are made available by your server.

  • Initiate Payload

    As a part of Initiate SDK call, signed payload has to be passed to the SDK. This will help Juspay in prefetching the enabled payment methods, refreshing wallet balances of the customer in advance. Please refer the Payload for Initiation for required parameters.

    It is highly recommended to call initiate SDK from the order summary page (atleast 5 seconds before starting the payment page) for a seamless user experience. This is to optimize background API calls to fetch/ create customer, refresh wallet balances and fetch enabled payment methods.
  • Process Payload

    Since the SDK is an enhanced Payments Orchestrator, the payload to Process SDK is typically a bunch of basic Payments payload parameters. Please refer the Payload for Process for required parameters.

II. Handling SDK responses

Please refer to SDK Response Handling. Code snippets are shown for Java, kotlin, Swift, Objective-C, and React. These code snippets basically add more detail to the event handling routines which were outlined in the response handling callbacks (listener for React) sent with the Initiate API.


III. Server to Server Calls

The Merchant will have to initiate server-to-server calls for the below use cases (unless webhooks are used in place of status calls- see below):

  1. Get Order Status API (post transaction): (/orders/:order_id)
    https://developer.juspay.in/v3.0/reference/get-order-status
  2. Refund Order API: (/orders/:order_id/refunds)
    https://developer.juspay.in/v3.0/reference/refund-order
  3. Update Order API: (/orders/:order_id)
    https://developer.juspay.in/v3.0/reference/update-order


If mandates are used, The Merchant will have to initiate these additional server-to-server calls for mandates (unless webhooks are used in place of status calls- see below):

  1. Mandate Order Status API: (/orders/:order_id)
    https://developer.juspay.in/v3.0/reference/get-mandate-order-status
  2. Get Mandate Execution Status API: (/txns/v2/orders/:order_id)
    https://developer.juspay.in/v3.0/reference/exercise-mandate-transaction-status
  3. List Mandates API (list mandates of customer): (/customers/:customer_id/mandates)
    https://developer.juspay.in/reference#list-mandate-api
  4. Revoke Mandate API: (/mandates/:mandate_id#revoke)
    https://developer.juspay.in/v3.0/reference/revoke-mandate-api

Handling S2S responses from Juspay Server (webhooks)

A URL must be set up in the merchant server configured as a 'Webhook'. Callbacks will be sent from the SDK to the webhook URL for various events resulting from API calls, such as: Payment Success/Failure, Order/Transaction Creation, etc. Using webhooks can eliminate the need to send status request APIs in many cases, which can simplify your transaction flow. Documentation for webhooks can be found here:
https://developer.juspay.in/v3.0/reference/outgoing-webhookcallback-1


What’s Next
Did this page help you?