For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Dashboard
GuidesAPI ReferenceSDKs
GuidesAPI ReferenceSDKs
  • API
      • POSTCancel transaction
      • POSTCapture transaction
      • POSTDeposit Transaction
      • POSTEstablish a new Transaction for authorization
      • GETGet transactions
      • POSTPreauthorize Transaction
      • POSTReclaim Transaction
      • POSTRefresh a transaction
      • POSTRefund Transaction
      • GETRetrieve a transaction
Dashboard
Products
PaymentsDataPayouts
Company
AboutCareersContact Sales

Terms of Use | Privacy Policy | © 2026 Trustly, Inc.

Developer-friendly docs for your API
GitHub|Contact Support|Business Help Center|Merchant Portal
Terms of Use|Privacy Policy|© 2026 Trustly, Inc.
Developer-friendly docs for your API
LogoLogo
North AmericaEurope
North AmericaEurope
APITransactions

Cancel transaction

|View as Markdown|Open in Claude|
POST
https://sandbox.trustly.one/api/v1/transactions/:transactionId/cancel
POST
/api/v1/transactions/:transactionId/cancel
$curl -X POST https://sandbox.trustly.one/api/v1/transactions/transactionId/cancel \
> -H "Content-Type: application/x-www-form-urlencoded" \
> -u "<username>:<password>" \
> -d "merchantReference=597E61428FCAED20" \
> -d "message=personalized%20message%20to%20describe%20the%20cancellation" \
> -d "reason=615" \
> -d "signature=16JAB0UL75BH"
200Example
1{
2 "transaction": {
3 "transactionId": "1002580075",
4 "transactionType": 1,
5 "payment": {
6 "paymentId": "1002580073",
7 "paymentType": 2,
8 "merchant": {
9 "merchantId": "1002463580"
10 },
11 "merchantReference": "123123",
12 "merchantId": "1002463580",
13 "fingerprint": "iSnTsj6TTOmPjqN5kE44aMkGqvk=",
14 "verification": {
15 "status": 3,
16 "mode": 3,
17 "verifyCustomer": false
18 },
19 "account": {
20 "name": "Demo Checking Account",
21 "type": -1,
22 "profile": 1,
23 "accountNumber": "6576",
24 "verified": false,
25 "verification": {
26 "verified": false,
27 "type": 2,
28 "hasEnoughFunds": false,
29 "verificationDate": 1619045543
30 },
31 "source": 1,
32 "token": "K0B1N06576"
33 },
34 "description": "Order",
35 "returnUrl": "https://yourdomain.com/return?",
36 "cancelUrl": "https://yourdomain.com/cancel?",
37 "notificationUrl": "http://yourdomain.com/notification?",
38 "currency": "USD",
39 "amount": "25.00",
40 "paymentProvider": {
41 "paymentProviderId": "200005501",
42 "type": 1,
43 "name": "Demo Bank",
44 "instantPayoutAvailable": false
45 },
46 "allowedPaymentProviderType": [
47 1,
48 2
49 ],
50 "auth": {
51 "token": "1N3Q51FJNN4",
52 "status": 7,
53 "message": "Voided"
54 },
55 "authorization": "1N3Q51FJNN4",
56 "authorizationStatus": 7,
57 "authorizationStatusMessage": "Voided",
58 "pending": "0.00",
59 "paid": "20.00",
60 "refunded": "2.00",
61 "reversed": "0.00",
62 "balance": "18.00",
63 "createdAt": 1555629937051,
64 "updatedAt": 1555691427347,
65 "recordVersion": 14,
66 "paymentFlow": 68
67 },
68 "currency": "USD",
69 "amount": "25.00",
70 "pending": "0.00",
71 "paid": "0.00",
72 "refunded": "0.00",
73 "reversed": "0.00",
74 "balance": "0.00",
75 "paymentProviderTransaction": {
76 "paymentProviderTransactionId": "ptx-g5sx_7bKcXlCB-fl1MsVEFt5-sbx",
77 "signature": "1N3Q51FJNN4",
78 "status": "13",
79 "statusMessage": "Canceled"
80 },
81 "status": 13,
82 "statusMessage": "Voided",
83 "ip": "73.93.152.163",
84 "createdAt": 1555629937054,
85 "processedAt": 1555629937054,
86 "completedAt": 1555629937054,
87 "updatedAt": 1555691427346,
88 "ppTrxId": "ptx-g5sx_7bKcXlCB-fl1MsVEFt5-sbx",
89 "merchantReference": "123123",
90 "automaticRepresentment": false,
91 "statusCode": "SW013",
92 "recordVersion": 4,
93 "instantPayoutSettle": true
94 }
95}
Cancels an existing transaction that has not yet been processed. A cancellation should be issued as soon as you know the transaction will not be completed. A Deferred or Instant payment transaction can only be canceled before the payment processing cut-off time. If the Cancel request returns an error, a Refund call should be executed instead. Additionally, this endpoint can be used to cancel a Bank Authorization when a user revokes access to their bank from your application. If the bank authorization transaction is voided, further `/capture` or `/deposit` requests using the canceled transaction will not be permitted. Any outstanding transactions with a `pending` status related to the bank authorization will remain unchanged and must be canceled individually if necessary.
Was this page helpful?
Previous

Retrieve Payment

Next

Capture transaction

Built with

Cancels an existing transaction that has not yet been processed. A cancellation should be issued as soon as you know the transaction will not be completed.

A Deferred or Instant payment transaction can only be canceled before the payment processing cut-off time. If the Cancel request returns an error, a Refund call should be executed instead.

Additionally, this endpoint can be used to cancel a Bank Authorization when a user revokes access to their bank from your application. If the bank authorization transaction is voided, further /capture or /deposit requests using the canceled transaction will not be permitted. Any outstanding transactions with a pending status related to the bank authorization will remain unchanged and must be canceled individually if necessary.

Authentication

AuthorizationBasic

Path parameters

transactionIdstringRequired

Request

merchantReferencestringOptional
A specific merchant reference for this cancellation. For example, this could be a merchant order number or the same merchant reference value used in the original establish call.
messagestringOptional

An optional message describing the reason for the cancellation. (maximum of 40 characters)

reasondoubleOptional
A specific reason code for this cancellation.
signaturestringOptional
A specific signature for this cancellation.

Response

OK
requiredany
transactionIdstring>=1 character

A unique transaction identifier generated by Trustly (15 character max).

transactionTypeenum

Type of transaction record. Definitions and descriptions can be found in this table

paymentobject
A Trustly Payment
currencyenum

3-letter ISO Currency Code. Currently only USD is supported.

Allowed values:
amountstring>=1 character

The amount of the transaction. (10 characters with support for 2 decimal places)

pendingstring>=1 character

The total amount that is still pending completion. (10 characters with support for 2 decimal places)

paidstring>=1 character

The total amount that was already paid. (10 characters with support for 2 decimal places)

refundedstring>=1 character

The total amount that was refunded. (10 characters with support for 2 decimal places)

reversedstring>=1 character

The total amount that was reversed. (10 characters with support for 2 decimal places)

balancestring>=1 character

The balance of the amount paid, minus the amount reversed and/or refunded. (10 characters with support for 2 decimal places)

paymentProviderTransactionobject
Payment Provider Transaction
statusenum

Status code of the Payment Provider Transaction record. Definitions and descriptions can be found in this table

statusMessagestring>=1 character

A descriptive status message. (120 characters)

ipstring>=1 character
The client IP address in IPv4 or IPv6 format.
createdAtinteger
The date and time the transaction was created as a UNIX timestamp.
processedAtinteger
The date and time the transaction was processed as a UNIX timestamp.
completedAtinteger
The date and time the transaction was completed as a UNIX timestamp.
updatedAtinteger
The date and time the transaction was last updated as a UNIX timestamp.
ppTrxIdstring>=1 character
internal use only
merchantReferencestring>=1 character
Merchants internal reference id for the transaction.
expiredAtinteger
The date and time the preauthorization will expire as a UNIX timestamp.
recordVersiondouble
The current record version.
originalTransactionIdstring
feestring
timeZonestring
representmentScheduledAtdouble
paymentProcessorTypestring
statusCodestring
preAuthorizedboolean