Create account reward
curl --request POST \
--url https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/rewards \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "CASH_BACK",
"amount": 20,
"description": "$20 reward",
"currency_code": "USD"
}
'import requests
url = "https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/rewards"
payload = {
"type": "CASH_BACK",
"amount": 20,
"description": "$20 reward",
"currency_code": "USD"
}
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({type: 'CASH_BACK', amount: 20, description: '$20 reward', currency_code: 'USD'})
};
fetch('https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/rewards', 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}/rewards",
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([
'type' => 'CASH_BACK',
'amount' => 20,
'description' => '$20 reward',
'currency_code' => 'USD'
]),
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}/rewards"
payload := strings.NewReader("{\n \"type\": \"CASH_BACK\",\n \"amount\": 20,\n \"description\": \"$20 reward\",\n \"currency_code\": \"USD\"\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}/rewards")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"CASH_BACK\",\n \"amount\": 20,\n \"description\": \"$20 reward\",\n \"currency_code\": \"USD\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/rewards")
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 \"type\": \"CASH_BACK\",\n \"amount\": 20,\n \"description\": \"$20 reward\",\n \"currency_code\": \"USD\"\n}"
response = http.request(request)
puts response.read_body{
"type": "CASH_BACK",
"token": "my_rewards_token1234",
"amount": 20,
"description": "$20 reward",
"created_time": "2023-09-03T22:53:57.895Z",
"updated_time": "2023-09-03T22:53:57.895Z",
"account_token": "my_account_token_12",
"currency_code": "USD"
}{
"code": 123,
"message": "<string>"
}Account Rewards
Create account reward
Create a reward for an existing credit account.
POST
/
credit
/
accounts
/
{account_token}
/
rewards
Create account reward
curl --request POST \
--url https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/rewards \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "CASH_BACK",
"amount": 20,
"description": "$20 reward",
"currency_code": "USD"
}
'import requests
url = "https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/rewards"
payload = {
"type": "CASH_BACK",
"amount": 20,
"description": "$20 reward",
"currency_code": "USD"
}
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({type: 'CASH_BACK', amount: 20, description: '$20 reward', currency_code: 'USD'})
};
fetch('https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/rewards', 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}/rewards",
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([
'type' => 'CASH_BACK',
'amount' => 20,
'description' => '$20 reward',
'currency_code' => 'USD'
]),
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}/rewards"
payload := strings.NewReader("{\n \"type\": \"CASH_BACK\",\n \"amount\": 20,\n \"description\": \"$20 reward\",\n \"currency_code\": \"USD\"\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}/rewards")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"CASH_BACK\",\n \"amount\": 20,\n \"description\": \"$20 reward\",\n \"currency_code\": \"USD\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.marqeta.com/v3/credit/accounts/{account_token}/rewards")
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 \"type\": \"CASH_BACK\",\n \"amount\": 20,\n \"description\": \"$20 reward\",\n \"currency_code\": \"USD\"\n}"
response = http.request(request)
puts response.read_body{
"type": "CASH_BACK",
"token": "my_rewards_token1234",
"amount": 20,
"description": "$20 reward",
"created_time": "2023-09-03T22:53:57.895Z",
"updated_time": "2023-09-03T22:53:57.895Z",
"account_token": "my_account_token_12",
"currency_code": "USD"
}{
"code": 123,
"message": "<string>"
}POST////
Create a reward for an existing credit account.
URL path parameters
| Fields | Description |
|---|---|
| account_token string Required | Unique identifier of the credit account for which you want to create a reward. Send a GET request to /credit/accounts to retrieve existing credit account tokens.Allowable Values: Existing account token |
Request body
| Fields | Description |
|---|---|
| token string Optional | Unique identifier of the reward. Allowable Values: 36 char max |
| description string Required | Description of the reward. Allowable Values: 255 char max |
| currency_code string Required | Valid three-digit ISO 4217 currency code. Allowable Values: USD |
| amount decimal Required | Amount of the reward. Allowable Values: 0 min |
| note string Optional | Additional information about the reward. Allowable Values: 255 char max |
| forced boolean Optional | Allows you to force the creation of a reward on an account. By default, reward creation is not permitted for accounts with a status of SUSPENDED or TERMINATED if more than 90 days have passed since the status transition.Allowable Values: true, false |
Sample request body
JSON
{
"token": "my_rewards_token1234",
"account_token": "my_account_token_12",
"type": "CASH_BACK",
"description": "$20 reward",
"currency_code": "USD",
"amount": 20,
"updated_time": "2023-09-03T22:53:57.895Z",
"created_time": "2023-09-03T22:53:57.895Z"
}
Response body
| Fields | Description |
|---|---|
| token string Returned | Unique identifier of the reward. If in the detail_object, unique identifier of the detail object.Allowable Values: 36 char max |
| account_token string Conditionally returned | Unique identifier of the account on which the reward exists. Allowable Values: 36 char max |
| type string Returned | Type of reward. Allowable Values: AUTO_CASH_BACK, CASH_BACK, STATEMENT_CREDIT |
| description string Returned | Description of the reward. Allowable Values: 255 char max |
| currency_code string Returned | Valid three-digit ISO 4217 currency code. Allowable Values: USD |
| amount decimal Returned | Amount of the reward. Allowable Values: 0 min |
| applied_to_amount decimal Conditionally returned | Total amount to which a percentage reward method is applied (for example, if a 3% reward is applied to 100, then 100 is the applied_to_amount value).This field is not applicable for a flat fee method. Returned for auto-cash back reward types only. Allowable Values: Format: 0.00 |
| method string Conditionally returned | Method, either a flat amount or a percentage. NOTE: Only FLAT is currently supported.Allowable Values: PERCENTAGE, FLAT |
| value decimal Conditionally returned | Value of the percentage or flat amount. Returned for auto-cash back reward types only. Allowable Values: Format: 0.00 |
| note string Conditionally returned | Additional information about the reward. Allowable Values: 255 char max |
| updated_time datetime Returned | Date and time when the reward was last updated on Marqeta’s credit platform, in UTC. Allowable Values: Format: yyyy-MM-ddThh:mm:ssZ |
| created_time datetime Returned | Date and time when the reward was created on Marqeta’s credit platform, in UTC. Allowable Values: Format: yyyy-MM-ddThh:mm:ssZ |
Sample response body
JSON
{
"token": "my_rewards_token1234",
"account_token": "my_account_token_12",
"type": "CASH_BACK",
"description": "$20 reward",
"currency_code": "USD",
"amount": 20,
"updated_time": "2023-09-03T22:53:57.895Z",
"created_time": "2023-09-03T22:53:57.895Z"
}
Authorizations
Path Parameters
Body
application/json
Valid three-digit link:https://www.iso.org/iso-4217-currency-codes.html[ISO 4217 currency code, window="_blank"].
Available options:
USD Maximum string length:
3Response
Newly created reward
Valid three-digit link:https://www.iso.org/iso-4217-currency-codes.html[ISO 4217 currency code, window="_blank"].
Available options:
USD Was this page helpful?