Transition account payment status
curl --request POST \
--url https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/payments/{payment_token}/transitions \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "RETURNED"
}
'import requests
url = "https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/payments/{payment_token}/transitions"
payload = { "status": "RETURNED" }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({status: 'RETURNED'})
};
fetch('https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/payments/{payment_token}/transitions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/payments/{payment_token}/transitions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'status' => 'RETURNED'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/payments/{payment_token}/transitions"
payload := strings.NewReader("{\n \"status\": \"RETURNED\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/payments/{payment_token}/transitions")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"RETURNED\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/payments/{payment_token}/transitions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"RETURNED\"\n}"
response = http.request(request)
puts response.read_body{
"token": "<string>",
"status": "INITIATED",
"account_token": "<string>",
"payment_token": "<string>",
"created_time": "2023-11-07T05:31:56Z"
}{
"code": 123,
"message": "<string>"
}Payments
Transition account payment status
Transition a credit account payment’s status to a new status.
POST
/
credit
/
accounts
/
{account_token}
/
payments
/
{payment_token}
/
transitions
Transition account payment status
curl --request POST \
--url https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/payments/{payment_token}/transitions \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "RETURNED"
}
'import requests
url = "https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/payments/{payment_token}/transitions"
payload = { "status": "RETURNED" }
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({status: 'RETURNED'})
};
fetch('https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/payments/{payment_token}/transitions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/payments/{payment_token}/transitions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'status' => 'RETURNED'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/payments/{payment_token}/transitions"
payload := strings.NewReader("{\n \"status\": \"RETURNED\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/payments/{payment_token}/transitions")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"RETURNED\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/payments/{payment_token}/transitions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"RETURNED\"\n}"
response = http.request(request)
puts response.read_body{
"token": "<string>",
"status": "INITIATED",
"account_token": "<string>",
"payment_token": "<string>",
"created_time": "2023-11-07T05:31:56Z"
}{
"code": 123,
"message": "<string>"
}POST//////
Transition a credit account payment’s status to a new status.
URL path parameters
| Fields | Description |
|---|---|
| account_token string Required | Unique identifier of the credit account for which you want to transition a payment status. Send a GET request to /credit/accounts to retrieve existing credit account tokens.Allowable Values: Existing account token |
| payment_token string Required | Unique identifier of the payment whose status you want to transition. Send a GET request to /credit/accounts/{account_token}/payments endpoint to retrieve existing payment tokens for a given account.Allowable Values: Existing payment token |
Request body
| Fields | Description |
|---|---|
| token string Optional | Unique identifier of the payment status transition. Allowable Values: 36 char max |
| status string Required | Current status of the payment or refund. Allowable Values: INITIATED, PENDING, PROCESSING, SUBMITTED, CANCELLED, COMPLETED, RETURNED, REFUNDED, SYS_ERROR, ACH_ERROR |
| refund_details object Optional | Contains details for a refund. Allowable Values: method, description |
| refund_details.method string Required | Payment instrument used to issue the refund. Allowable Values: ACH, CHECK |
| refund_details.description string Required | Description of the refund. Allowable Values: 255 char max |
| waive_returned_payment_fee boolean Optional | A value of true indicates that a returned payment fee should not be applied if one is applicable. This is false by default. This field is only considered during a transition to REFUNDEDAllowable Values: true, false |
Sample request body
JSON
{
"status": "RETURNED"
}
Response body
| Fields | Description |
|---|---|
| token string Returned | Unique identifier of the payment status transition. Allowable Values: 36 char max |
| account_token string Returned | Unique identifier of the credit account on which you want to transition a payment status. Allowable Values: Existing account token |
| payment_token string Returned | Unique identifier of the payment whose status you want to transition. Allowable Values: Existing payment token |
| status string Returned | Current status of the payment or refund. Allowable Values: INITIATED, PENDING, PROCESSING, SUBMITTED, CANCELLED, COMPLETED, RETURNED, REFUNDED, SYS_ERROR, ACH_ERROR |
| created_time datetime Conditionally returned | Date and time when the payment transition was created on Marqeta’s credit platform, in UTC. Allowable Values: Format: yyyy-MM-ddThh:mm:ssZ |
Authorizations
Path Parameters
Body
application/json
Request used to transition the status of a payment.
Response
Payment Transition Response object.
Response containing payment transition information.
New status to which the payment is transitioned.
- (ACH payments only)
CANCELLED- The payment is canceled. - (Non-ACH payments only)
RETURNED- For non-ACH payments, the payment is returned.
Available options:
INITIATED, PENDING, PROCESSING, SUBMITTED, CANCELLED, COMPLETED, RETURNED, REFUNDED, SYS_ERROR, ACH_ERROR Was this page helpful?