GPA Unloads

Learn how to create and retrieve a GPA unload with Marqeta's Core API.

Overview

In this lesson, we’ll learn how to unload a GPA order. We’ll also learn how to retrieve a specific GPA unload with its unique token.

Create a GPA unload

We can unload a GPA order by making a POST request to the {BASE_URL}/gpaorders/unloads endpoint. This allows us to return the funds from the GPA to the funding source. We must specify the token of the original GPA order that we want to unload in addition to the amount to be returned. This amount must be less than or equal to the amount of the original GPA order.

Request Parameters

Parameter

Type

Category

Description

amount

decimal

required

Amount to return

original_order_token

string

required

Token of the original GPA order we want to unload

Length: 1–36 characters

funding_source_address_token

string

optional

Token of the funding source we want to return the funds to

Length: 1–36 characters

token

string

optional

Unique token of the GPA unload

Length: 1–36 characters

Note: If not specified, the system generates one automatically. This value cannot be updated once set.

tags

string

optional

Comma-separated list of tags to describe the GPA unload

Maximum length: 255 characters

memo

string

optional

Additional text to describe the GPA unload

Maximum length: 99 characters

Line 4: We enter the value for the required parameter, amount.

Line 5: We use the GPA_ORDER_TOKEN value that we saved in the previous lesson for original_order_token.

Note: You can also enter values for the other optional parameters given in the table above.

Click the “Run” button in the code widget below to see the output.

Press + to interact
url = '{{BASE_URL}}gpaorders/unloads'
data = json.dumps({
"amount": "",
"original_order_token": "{{GPA_ORDER_TOKEN}}"
})
response = requests.post(url, headers=headers, data=data)
printResponse(response)
printBalances('{{USER_TOKEN}}')

When the code is executed successfully, the output displays the complete GPA unload object with all of the requested data fields. It displays the updated GPA balances for the user. It also extracts the token value and saves it as GPA_UNLOAD_TOKEN.

In case of failure, an appropriate error message is displayed.

Get GPA unload information

We can get information about a GPA unload by making a GET request to the {BASE_URL}/gpaorders/unloads/{unload_token} endpoint. The path parameter ({unload_token}) refers to the token of the GPA unload that we want to retrieve.

Path Parameter

Parameter

Type

Category

Description

unload_token

string

required

Token of the GPA unload we want to retrieve

Line 1: We use the GPA_UNLOAD_TOKEN that we extracted in the previous code for the value of unload_token, which is a required path parameter.

Click the “Run” button in the code widget below to see the output.

Press + to interact
unload_token = '{{GPA_UNLOAD_TOKEN}}'
url = '{{BASE_URL}}gpaorders/unloads/' + unload_token
response = requests.get(url, headers=headers)
printResponse(response)

When the code is executed successfully, the output displays the complete GPA unload object that corresponds to the given unload_token with all of the requested data fields.

In case of failure, an appropriate error message is displayed.