Developers
...
Developer Hub
Developer Tutorials

Creating a Payment Session Tutorial

Creating a Payment Session

This tutorial is for your back-end server.

In this tutorial, we will cover creating a payment session, by calling the Judopay Transaction API. The purpose of the payment session is to verify the identity of the cardholder, to prevent fraudulent transactions and refunds.

The payment session reference is used when calling our Web SDK’s payment functions from your client side.

Full Tutorial

In this tutorial, we will be using PHP as our server-side scripting language. You may use any server-side language you wish, as we have a REST API (which responds with JSON).



We have created video chapters from the full tutorial, to help you easily re-watch different parts of the tutorial. We have included an overview and example code snippets for each section below:

When using the code snippets, ensure to replace any field values with your own values.



1. Intro





Payment Flow:

tutorial payment session diagram
Payment Flow



2. Defining parts of the request

To make a request to Judopay’s Transaction API we first need to define:

  • The request headers
  • The environment server URL
  • The request endpoint
  • The request body

Ensure that the data used here, is also used later when calling Web SDK functions from your client side. For example judoId, API Token / Secret, yourConsumerReference.


Define parts of the Request



3. Making a request to Judopay's Transaction API

Pulling together everything we have defined, to make a POST request to Judopay’s Transaction API payment session endpoint.


POST Request Example



4. Handling the API response

For a successful response, the payment session reference value should be stored in your backend server. This value should be passed to your client side when it is calling Web SDK functions (where the reference value is passed as a parameter).


Handle the Response



Resources