Skip to content

Online Payment

The following documentation describes how to set up online payments via API through the PSP implemented by Resamania on behalf of the club.

Resamania currently allows the use of two different PSPs:

  • Payline
  • Stripe

Macro process and prerequisites

The process for using promo codes follows these steps:

  1. Create a sale (see the dedicated documentation)
  2. Create a payable object
  3. Redirect the user to the payment form
  4. Handle success or failure
  5. Retrieve the payment status

Create a payable object

POST {clientToken}/payable_objects

PayableObjects are payment requests. By specifying which entities (sale) and what amount you want to pay online, you will receive in return a representation of the payableObject allowing you to redirect the user to the online payment form.

You must specify validUrl and cancelUrl:

  • validUrl is the URL to which the user is redirected in case of success or in case of error
  • cancelUrl is the URL to which the user is redirected if they cancel the transaction

WARNING

To know whether the payment is accepted or not, you must take care to retrieve the payment status.

NOTE

You can request only part of the sale amount for online payment. For example, if the contact wants to pay the remaining amount at the club.

Redirect the user

The redirection of the user depends on the PSP used.

In the case of Payline

The redirection is simple: you must retrieve the redirectURL from the PayableObject received in response.

In the case of Stripe

The case of Stripe is a bit special since we use the elements provided by Stripe.
A demo GitHub repository details how to implement it: https://github.com/stadline/resamania2-partners-examples/tree/master/stripe/react [Accessible here]

Handle success or failure

If the user has canceled their transaction, they are redirected to your cancelUrl.
If they validated or failed their transaction, they are redirected to your validUrl.

It is then up to you to retrieve the payment status (see below).

WARNING

Note that no information is returned to these pages (neither reference nor identifiers) that would allow you to identify the user and their order. It is up to you to include them in your validUrl and cancelUrl.

If you used the same URL for both success and failure, follow the next step to retrieve the payment status and display the correct page to your user.

Retrieve the payment status

Use the endpoint PUT /{clientToken}/payable_objects/{id}/check to retrieve the payment status.
This endpoint checks whether Resamania already knows the status of the payment, and if not, requests the information directly from the PSP.

In return, you will receive the updated PayableObject.

Rely on its state property to know its status. You can also use its logs property to get more information.

StateDescription
createdJust created, not yet used
pendingWaiting for information from the PSP
requestedPayment pending
canceledPayment request canceled
validatedPayment received
refusedPayment refused