Validating your implementation with the test connector
In this guide, we will use the test connector to validate our implementation.
In order to validate your implementation, you can use the test connector which you can enable on your sandbox domain, with the UUID 338178e6-3d01-564f-9a7b-52ca442459bf
.
Formatting the label
With this institution, you can simulate various scenarios, depending on the label of the first instruction in the payment. The label resembles this:
The payment states are described on the left of the first found caret (-
), separated from each other by slashes (/
).
In the provided example, assuming the payment is a single "first open day" payment, once validated, it will be "pending"
for 15 minutes, then "done"
.
A scenario can have up to 3 different states, for which the possible values are the following:
pdng
: pending.canc
: rejected (by the end user).rjct
: rejected (by the bank, generic).err
: rejected (by the bank, for an invalid amount).bug
: an error will have occurred during the payment initiation.done
: done.
If no final state is provided, the final state will be "done"
.
Example scenarios are:
pdng/pdng/done
: the payment will be pending execution during 30 minutes, before done.pdng/rjct
: the payment will be pending execution during 15 minutes, before being rejected for a generic reason.err
: the payment will be rejected by the bank for an invalid amount.
Create a first open day payment with the test connector
Here, we will create a first open day that will be pending
then done
. Note that this is a partial reprisal of Initiating a one-time payment with the Webview.
Obtain a token suitable for creating payments
In order to create payments, we need a special access token with the payments:admin
scope, obtained using client credentials:
Create the first open day payment
You can now create a payment request with the following request:
Now we have the payment identifier, in order to validate it, we must create a webview URL and send our PSU on it.
Obtain the payment validation token
As in the original guide, we get a token suitable for payment validation here:
Build the payment validation URL
Now that you have the payment validation token, you can create the webview URL by taking the webview URL and adding the following parameters to it:
client_id
: the client identifier for your application (clientId
).redirect_uri
: the same redirect URL you've used when creating the payment (redirectURL
).state
: the same state you've used when creating the payment (optionalRedirectState
).code
: The scoped token you've generated on your previous request to the API.payment_id
: the identifier of the payment.
This will make you obtain an URL of the form:
You can redirect your payer to this URL.
Receive the callback from the payer
Once the payer has either completed the payment validation flow, they will arrive on the callback URL you have configured on the payment with the following parameters:
state
: the optional client state you have configured on the payment, i.e.{optionalClientState}
.id_payment
: the identifier of the payment that the user comes from.payment_state
: the state of the payment, set to"pending"
here.
If your implementation is correct, following this callback, you should directly use the GET /payments/{id}
endpoint, with the identifier of the payment, to get the current state of the payment, which is indeed "pending"
. See API endpoints for more information.
For more details on these parameters, see Receive the callback from the payer in the original guide.
Receive webhook events regarding the payment's state
After approximately 15 minutes, you will receive a "PAYMENT_STATE_UPDATED"
webhook event advertising that the payment is now "done", with the full data regarding the payment.
You can test behaviours with shorter intervals using "instant"
payments; every phase with such payments last 15 seconds instead of 15 minutes, so your payment will have reached its final state within about one minute.
During and after the initiation of a payment, you may want to check on the status of a payment, or to get data back from the payment initiation request.
For more information, see Webhooks in the Payments API reference.
Last updated