When a user completes or cancels the Trustly UI workflow, the SDK will redirect to the
cancelUrl ,respectively. Several pieces of information will be provided to the redirect URL by query parameters. This information may be used to call Trustly APIs or prompt the user to select another method of payment.
Receiving the Redirect
Trustly will return the User to your
returnUrl via a
GET request, appending a number of fields to the provided URL. You can then pass this data to your backend for further processing.
To prevent tampering of the redirect URL when handling the redirect make sure that:
- The merchantReference sent on the Establish Data is unique and associated with the end-user session
- The merchantReference on the return URL is the same as the merchantReference sent on the EstablishData for this user session
- Ensure you check the validity of the request by verifying the Redirect Signature in your back end before you process it or by calling the Get Transaction API and checking if the values returned are the same as the parameters sent on the redirect URL.
Example Redirect Request
|transactionId||A unique Trustly transaction identifier. (15 characters)|
|transactionType||See Transaction Types for a complete list of values and their definitions.|
|merchantReference||A specific merchant reference for this cancelation. For example, this could be your order number or session id.|
|status||See Transaction Status Values for a complete list of values and their definitions.|
|payment.paymentType||See Payment Types for a complete list of values and their definitions.|
|payment.paymentProvider.type||See Payment Provider Types|
|panel||Integer value representing the Trustly screen the user exited the flow on. Refer to Panel Values for a complete list of values and their definitions.|
|payment.paymentProviderTransaction.status||Integer value representing the Payment Provider Transaction Status of the transaction. Refer to Payment Provider Transaction Status for a complete list of values and their definitions.|
|requestSignature||This is a signature that you can calculate to ensure the request you receive is coming from Trustly. See Verifying the Redirect Request for more information.|
Updated 2 months ago