State
The Trustap API uses state
in creating full Trustap users and in the payment screen.
The state parameter in the Trustap API serves two main purposes.
- It protects against CSRF.
- It allows you to pass contextual information like a shopping cart ID or buyer details.
Payment continuation using state
The Trustap payment screen supports payment continuation. To reduce additional friction, you can choose to pre-populate your buyer`s details in the payment screen.
The Base64 encoded string is passed in the URL that you send your buyer using the state
parameter. The string is delimited using the colon character :
. The format of the string is parameter 1=value 1:parameter 2=value 2:parameter 3=value 3
.
https://actions.stage.trustap.com/online/transactions/25273/guest_pay?redirect_uri=https://www.example.com&state=bmFtZT1EYXZleSBKb25lczpsaW5lMT1NYXJrZXQgU3RyZWV0OmxpbmUyPURvd250b3duOmNpdHk9Qm9zdG9uOnN0YXRlPU1BOnBvc3Rjb2RlPURZMTAgNUZTOmNvdW50cnk9VVM=
You can use additional unspecified parameters for your own purposes that will be ignored by payment continuation. For example, token=678fe24e01dbe4a798eeb85de6a31940:
.
Supported parameters
Parameter | Description |
---|---|
name | Buyer's name. Should contain first and surname |
line1 | Address line 1 (e.g., street, PO Box, or company name) |
line2 | Address line 2 (e.g., apartment, suite, unit, or building) |
city | City, district, suburb, town, or village |
state | State, county, province, or region |
postcode | ZIP or postal code. |
country | Two-letter country code (ISO 3166-1 alpha-2) |
Preview payment continuation using state
Use the following example to test how the payment form looks with pre-filled buyer information. Edit the State string to see the sample payment form pre-populated.