
Settlement Risk: Trustly is a bank transfer payment method. Fund settlement may be delayed — a successful payment status does not guarantee that funds have arrived. Please refer to the Fund Status Notification as the definitive confirmation before shipping goods or providing services.
html
<div id="checkoutTrustlyField"></div>javascript
import { Trustly } from '@paykka/card-checkout-ui'
const checkoutTrustly = paykkaCheckout.create(Trustly, {
onSubmit: formValidateError => {
console.log('Trustly payment submitted:', formValidateError)
},
onSuccess: data => {
console.log('Trustly payment successful:', data)
},
onError: error => {
console.log('Trustly payment failed:', error)
}
})
checkoutTrustly.mount('#checkoutTrustlyField')Passed when calling the create method to create Trustly.
| Name | Description | Type | Default |
|---|---|---|---|
| showEmail | Whether to display email.
| boolean | false |
| showAddress | Whether to display address.
| boolean | false |
| hidePaymentButton | Whether to hide the payment button. After hiding it, you can trigger payment manually through the component ref's payment() method. | boolean | false |
| onSubmit | Payment submission callback, triggered after clicking the payment button.
| (formValidateError?: Record<string, FormValidateError[]>) => void | boolean | Promise<void | boolean> | undefined |
| onSuccess | Callback after successful payment.
| (data: PaymentSuccessData) => void | undefined |
| onError | Callback after payment failure, can resubmit for payment.
| (error: PayKKaError) => void | undefined |
| onTimeout | Callback when payment times out, can resubmit for payment. | () => void | undefined |
| onExpired | Callback when the checkout counter has expired during payment, cannot pay again. | () => void | undefined |
Methods and properties exposed by Trustly, can be called by the Trustly instance created via the create method, e.g.: checkoutTrustly.ref.payment().
| Name | Description | Type |
|---|---|---|
| payment | Make a payment, enabled when the payment button is not visible. | () => void |
Below is an explanation of some data types:
Payment success information.
interface PaymentSuccessData {
/** URL that can be redirected to after successful payment */
returnUrl?: string
}