> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://amer.developers.trustly.com/llms.txt.
> For full documentation content, see https://amer.developers.trustly.com/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://amer.developers.trustly.com/_mcp/server.

# Refresh a transaction

POST https://sandbox.trustly.one/api/v1/transactions/{transactionId}/refresh
Content-Type: application/x-www-form-urlencoded

Refresh allows for data associated with a transaction to be updated to the most recent available.

Reference: https://amer.developers.trustly.com/api-reference/api/transactions/post-transactions-refresh

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Trustly API
  version: 1.0.0
paths:
  /transactions/{transactionId}/refresh:
    post:
      operationId: post-transactions-refresh
      summary: Refresh a transaction
      description: >-
        Refresh allows for data associated with a transaction to be updated to
        the most recent available.
      tags:
        - subpackage_transactions
      parameters:
        - name: transactionId
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: ''
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Transactions_post-transactions-refresh_Response_200
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              type: object
              properties:
                splitToken:
                  type: string
                  description: >-
                    Token received from the Authorize event. Note: string value
                    must be URL encoded.
              required:
                - splitToken
servers:
  - url: https://sandbox.trustly.one/api/v1
components:
  schemas:
    TransactionsTransactionIdRefreshPostResponsesContentApplicationJsonSchemaRefresh:
      type: object
      properties:
        processId:
          type: string
      required:
        - processId
      title: >-
        TransactionsTransactionIdRefreshPostResponsesContentApplicationJsonSchemaRefresh
    Transactions_post-transactions-refresh_Response_200:
      type: object
      properties:
        refresh:
          $ref: >-
            #/components/schemas/TransactionsTransactionIdRefreshPostResponsesContentApplicationJsonSchemaRefresh
      required:
        - refresh
      title: Transactions_post-transactions-refresh_Response_200
  securitySchemes:
    HTTPBasic:
      type: http
      scheme: basic
      description: ''

```

## SDK Code Examples

```python Example
import requests

url = "https://sandbox.trustly.one/api/v1/transactions/transactionId/refresh"

payload = ""
headers = {
    "Content-Type": "application/x-www-form-urlencoded"
}

response = requests.post(url, data=payload, headers=headers, auth=("<username>", "<password>"))

print(response.json())
```

```javascript Example
const url = 'https://sandbox.trustly.one/api/v1/transactions/transactionId/refresh';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'POST',
  headers: {
    Authorization: `Basic ${credentials}`,
    'Content-Type': 'application/x-www-form-urlencoded'
  },
  body: new URLSearchParams('')
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://sandbox.trustly.one/api/v1/transactions/transactionId/refresh"

	req, _ := http.NewRequest("POST", url, nil)

	req.SetBasicAuth("<username>", "<password>")
	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Example
require 'uri'
require 'net/http'

url = URI("https://sandbox.trustly.one/api/v1/transactions/transactionId/refresh")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request.basic_auth("<username>", "<password>")
request["Content-Type"] = 'application/x-www-form-urlencoded'

response = http.request(request)
puts response.read_body
```

```java Example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sandbox.trustly.one/api/v1/transactions/transactionId/refresh")
  .basicAuth("<username>", "<password>")
  .header("Content-Type", "application/x-www-form-urlencoded")
  .asString();
```

```php Example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox.trustly.one/api/v1/transactions/transactionId/refresh', [
  'form_params' => null,
  'headers' => [
    'Content-Type' => 'application/x-www-form-urlencoded',
  ],
    'auth' => ['<username>', '<password>'],
]);

echo $response->getBody();
```

```csharp Example
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://sandbox.trustly.one/api/v1/transactions/transactionId/refresh");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
IRestResponse response = client.Execute(request);
```

```swift Example
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/x-www-form-urlencoded"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox.trustly.one/api/v1/transactions/transactionId/refresh")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```