PUT Update a Staged Transaction
PUT /transfer/v1/stagedtransactions/{transactionId}
Development Guide
The 'Update a Staged Transaction' endpoint determines the information to collect from the consumer, it also validates the data for compliance purposes and updates the transactionId resource with the data gathered. Use this endpoint after retrieving a staged transaction via the Search Staged Transactions endpoint.
1. Prepare headers & authentication:
The application must call the 'Update a Staged Transaction' endpoint with a PUT HTTP method, providing the OAuth access_token in the header and all other required header values.
Note: MoneyGram uses the OAuth 2.0 framework. The application must use their OAuth client credentials to generate an
access_tokenby calling the Get access token endpoint. The token is valid for **1 hour ** and must be passed as a header value in all subsequent API HTTP calls. Learn More
Launch Code Example
2. Provide the transactionId resource as a path parameter
transactionId resource as a path parameterThe application must pass the associated transactionId as a path parameter on the Update API. This will allow the application to update the transactionId resource with consumer and transactional information. The transactionId will have been previously generated from search staged transaction.
Launch Code Example
3. Provide request body.
The application must use the oneOfto select the appropriate request schema: TransfersStagedTranRequest or TransfersStagedTranWithAddlnDataRequestoneOf:
- TransfersStagedTranRequestThe application can provide the following optional fields in the request body:
targetAudience,agentPartnerId,posId,operatorId,userLanguage,receipt.primaryLanguage, andreceipt.secondarylanguagereceipt.image.
OR
- TransfersStagedTranWithAddlnDataRequest The application can provide the following optional fields in the request body:
targetAudience,agentPartnerId,posId,operatorId,userLanguage,transactionInformation.purposeOfTransactionCode,transactionInformation.sourceOfFundsCode,transactionInformation.proofofFundsCode,transactionInformation.intendedUseOfMGIServicesCode,transactionInformation.relationshipToReceiver,transactionInformation.senderAnnaulIncome,receipt.primaryLanguage,receipt.secondarylanguage,additionalDetails.key,additionalDetails.value,documentImage.imageReferenceId,documentImage.imageVerification, anddocumentImage.imageTypeCode.
Launch Code Example.
4. Make a request and handle response:
The application must call the 'Update a transaction' endpoint with a PUT HTTP method. The application must build to handle the following response scenarios:
- Success | Parse the Response | 200 OK HTTP Status |
"readyToCommit": true
When the 'Update a staged transaction' endpoint responds with a 200 HTTP Status and the"readytoCommit": true,transactionId,serviceOption,sender,receiver,sendAmount,sendCurrency,fees,fxRate,discountsApplied,receiveAmountand thetotal. In some cases, send or receive side taxes and/or additional charges are applied. The application can proceed to "Commit a staged transaction" API and execute the transfer of funds.
- Failed | Handle the Error | 400 Bad Request HTTP Status
When the 'Update a staged transaction' endpoint responds with 400 Bad Request HTTP Status the application cannot proceed to the "Commit a staged transaction" endpoint. Specific error code/s will be returned with an array of offending fields. The application will need to resolve these errors and resubmit the transaction for validation. The application can make repeated attempts on the 'Update a transaction' endpoint until validation is successful.
Note: In some scenarios, enhanced due diligence needs to be undertaken on the consumer. Specific error code/s will be returned and an array of offending fields. The fields/values must to be provided and resubmitted on the Update API for further checks.
Launch Code Example.
7. You're Done! Proceed to 'Commit a Staged Transaction API':
The application can call the 'Commit a staged transaction' endpoint to execute the transfer when a 200 HTTP Success Status and the boolean "readyForCommit": true is returned on the Update response. The application must use the associated transactionId on the subsequent Commit a Staged Transaction API by providing it as a path parameter. The Commit endpoint is the final API call and will execute the transaction to MoneyGram.
Note: the application cannot proceed until the
"readyForCommit": true. The Application must correct and resubmit the data to until they get a"readyForCommit": true
Code Examples
const axios = require('axios');
const { v4: uuidv4 } = require('uuid');
const updateStagedTransaction = async () => {
const token = "your_access_token_from_oauth_response";
const transactionId = "transactionId";
// Production: extapi.moneygram.com | Test: sandboxapi.moneygram.com
const host = "sandboxapi.moneygram.com";
const url = `https://${host}/transfer/v1/stagedtransactions/${transactionId}`;
const headers = {
'Content-Type': 'application/json',
'X-MG-ClientRequestId': uuidv4(),
'Authorization': `Bearer ${token}`,
};
const request = {
agentPartnerId: "your_partner_id",
targetAudience: "AGENT_FACING",
userLanguage: "en-US",
receipt: {
primaryLanguage: "ENG",
secondaryLanguage: "SPA",
image: "base64_receipt_image_string"
},
transactionInformation: {
purposeOfTransactionCode: "FAMILY_SUPPORT",
sourceOfFundsCode: "SALARY",
relationshipToReceiver: "FAMILY"
},
additionalDetails: [
{ key: "customKey", value: "customValue" }
]
};
try {
const response = await axios.put(url, request, { headers });
// Check readyForCommit before proceeding to Commit API
console.log(JSON.stringify(response.data, null, 2));
} catch (error) {
if (error.response) {
console.log('Status:', error.response.status);
console.log('Body:', error.response.data);
} else {
console.error('Error:', error.message);
}
}
};
updateStagedTransaction();import requests, uuid
def update_staged_transaction():
token = "your_access_token_from_oauth_response"
transaction_id = "staged_tx_id"
host = "sandboxapi.moneygram.com"
url = f"https://{host}/transfer/v1/stagedtransactions/{transactionId}"
headers = {
"Content-Type": "application/json",
"X-MG-ClientRequestId": str(uuid.uuid4()),
"Authorization": f"Bearer {token}",
}
payload = {
"agentPartnerId": "your_partner_id",
"targetAudience": "AGENT_FACING",
"userLanguage": "en-US",
"receipt": {
"primaryLanguage": "ENG",
"secondaryLanguage": "SPA",
"image": "base64_receipt_image_string"
},
"transactionInformation": {
"purposeOfTransactionCode": "FAMILY_SUPPORT",
"sourceOfFundsCode": "SALARY",
"relationshipToReceiver": "FAMILY"
},
"additionalDetails": [
{"key": "customKey", "value": "customValue"}
]
}
resp = requests.put(url, json=payload, headers=headers)
if resp.ok:
print(resp.json())
else:
print(f"Error {resp.status_code}:", resp.json())
update_staged_transaction()import java.net.http.*;
import java.net.URI;
import java.util.UUID;
public class UpdateStagedTransaction {
public static void main(String[] args) throws Exception {
String token = "your_access_token_from_oauth_response";
String transactionId = "transactionId";
String host = "sandboxapi.moneygram.com";
String url = "https://" + host + "/transfer/v1/stagedtransactions/" + transactionId;
String body = """
{
"agentPartnerId": "your_partner_id",
"targetAudience": "AGENT_FACING",
"userLanguage": "en-US",
"receipt": {
"primaryLanguage": "ENG",
"secondaryLanguage": "SPA",
"image": "base64_receipt_image_string"
},
"transactionInformation": {
"purposeOfTransactionCode": "FAMILY_SUPPORT",
"sourceOfFundsCode": "SALARY",
"relationshipToReceiver": "FAMILY"
}
}""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer " + token)
.header("X-MG-ClientRequestId", UUID.randomUUID().toString())
.PUT(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response =
client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
Support APIs
To make your development easier, MoneyGram has provided a Reference Data APIs Module that can be queried to provide a list of supported fields, values and associated meta-data to use in your integration.
| Name | HTTP Method | Endpoints | Description |
|---|---|---|---|
| Retrieve Enumerations | GET | /reference-data/v1/enumerations | Retrieves enumerated values for fieldsRetrieves enumerated values for fields |
API Structure
Header Parameters
| Field | Type | Required /Optional | Description |
|---|---|---|---|
X-MG-ClientRequestId | String | Required | Client Request Id that can be passed by the client application. Client request Id must be unique within a single session for unique requests. This attribute can be used for ensuring idempotent request processing for some APIs. MoneyGram recommends using a UUID for the value of this field. |
X-MG-ConsumerIPAddress | String | Optional | IP Address of the system initiating the session |
Path Parameters
Path Parameter | Type | Required /Optional | Description |
|---|---|---|---|
| String Max length: 36 | Required | Unique id of the transaction resource |
Request Body Parameters
| Body Parameter | Description |
|---|---|
| TransferByStagedTranRequest | Business details + receipt object. Basic update with receipt language and image. |
| TransferByStagedTranWithAddlnDataRequest | Extends the base request with transactionInformation, additionalDetails, and documentImage. |
Request Body Fields with TransfersStagedTranRequest
| Field | Type | Required /Optional | Description |
|---|---|---|---|
targetAudience | String | Required | Tailors MoneyGram’s error messages and field metadata to an in-store, digital or crypto consumer. (Enumerated value) _NOTE: For a full list of accepted target audience values. See the TARGET_AUDIENCE enumeration from the Reference Data Enumerations endpoint _ |
agentPartnerId | String Max length: 8 | Required | Unique identifier for the agent or partner |
posId | String | Optional | Point of sale identifier of the client performing the API Call |
operatorId | String Max length: 80 | Required | Operator name or ID of the user performing the transaction. Name or ID must be populated from the agent/partner system and cannot be edited by the user. |
userLanguage | String Max length: 6 | Optional | Language used by the user/operator |
receipt.primaryLanguage | String | Optional | Primary receipt language of the transacting partner |
receipt.secondaryLanguage | String | Optional | Secondary receipt language of the transacting partner |
receipt.image | String | Optional | Receipt image string of the transacting partner |
Request Body Fields with TransfersStagedTranWithAddlnRequest
| Field | Type | Required /Optional | Description |
|---|---|---|---|
targetAudience | String | Required | Tailors MoneyGram’s error messages and field metadata to an in-store, digital or crypto consumer. (Enumerated value) _NOTE: For a full list of accepted target audience values. See the TARGET_AUDIENCE enumeration from the Reference Data Enumerations endpoint _ |
agentPartnerId | String Max length: 8 | Required | Unique identifier for the agent or partner |
posId | String | Optional | Point of sale identifier of the client performing the API Call |
operatorId | String Max length: 80 | Required | Operator name or ID of the user performing the transaction. Name or ID must be populated from the agent/partner system and cannot be edited by the user. |
userLanguage | String Max length: 6 | Optional | Language used by the user/operator |
receipt.primaryLanguage | String | Optional | Primary receipt language of the transacting partner |
receipt.secondaryLanguage | String | Optional | Secondary receipt language of the transacting partner |
receipt.image | String | Optional | Receipt image string of the transacting partner |
transactionInformation.purposeofTransactionCode | String | Optional | Explanation or reason for transferring funds (Enumerated Values) Reference Data Enumerations endpoint _ |
transactionInformation.sourceOfFundsCode | String | Optional | Declaration of where the transaction funds were sourced (Enumerated Values) Reference Data Enumerations endpoint _ |
transactionInformation.proofOfFundsCode | String | Optional | Proof of where the transaction funds were sourced (Enumerated Values) NOTE: For a full list of accepted proof of funds values. See the PROOF_OF_FUNDS enumeration from the Reference Data Enumerations endpoint |
transactionInformation.intendedUseOfMGIServicesCode | String Max length: 30 | Optional | Explanation for using MoneyGram service (Enumerated Values) NOTE: For a full list of accepted use of MGI services values. See the TYPICAL_USE_OF_MGI enumeration from the Reference Data Enumerations endpoint |
transactionInformation.relationshipToReceiver | String Max length: 30 | Optional | Declaration of consumer's relationship to the counter party (Enumerated Values) NOTE: For a full list of relationships values. See the RLTIONSHP_TO_RECIVR enumeration from the Reference Data Enumerations endpoint |
transactionInformation.senderAnnualIncome | String Enumerated Value | Optional | Sender's annual income bracket |
additionalDetails | Dynamic | Optional | Dynamic field key/values |
documentImage.imageReferenceId | String | Optional | Document Reference ID from Upload |
documentImage.imageVerification | String | Optional | Verification of ID on file with entering ID Number |
documentImage.imageTypeCode | String | Optional | Type of identification document (Enumerated Value) |
Response Fields
Field | Type | Required /Optional | Description |
|---|---|---|---|
| Boolean | Required | Indicates whether the transaction can proceed to commit |
| String Max length: 8 | Optional | Unique identifier for the agent or partner |
| String Max Length: 20 | Required | MoneyGram Rewards number |
| String | Required | Consumer facing name to identify the transaction method |
| String | Optional | Unique name of the individual banking, wallet, or card provider |
| String Max Length: 3 | Required | Transaction Destination Country (ISO alpha-3 code) NOTE: For a full list of accepted destination Countries and supported destinationCountrySubdivisionCode see Reference Data API Module: Retrieve Countries ISO3 endpoint |
| String Max length: 6 | Conditionally Required | Destination state/province is conditionally required when transacting to the United States or Canada. NOTE: For a full list of accepted destination Countries and supported destinationCountrySubdivisionCode see Reference Data API Module: Retrieve Countries ISO3 Endpoint |
| String Min length: 1 Max length: 20 | Required | First Name |
| String Min length: 1 Max length: 20 | Optional | Middle Name (if applicable) |
| String Min length: 1 Max length: 30 | Required | Last Name |
| String Min length: 1 Max length: 30 | Optional | Second Last Name |
| String Min length: 5 Max length: 30 | Required | Residence address line 1 |
| String Min length: 0 Max length: 80 | Optional | Residence address line 2 (if applicable) |
| String Min length: 0 Max length: 80 | Optional | Residence address line 3 (if applicable) |
| String Min length: 1 Max length: 40 | Required | City of residence |
| String Length: 6 | Optional | State/province of residence |
| String Length: 3 | Required | Country of residence (ISO Alpha-3 Code) |
| String Min length: 2 Max length: 6 | Optional | Postal code/ZIP of residence |
| String Min length: 5 Max length: 14 | Required | Phone number |
| String Min length: 1 Max length: 3 | Required | Country calling code NOTE: For country calling code see Reference Data API Module /countries endpoint |
| String Min length: 1 Max length: 255 | Optional | Email address |
| String | Optional | Gender (Enumerated Value) |
| String Length: 10 | Required | Date of birth (YYYY-MM-DD) |
| String Min length: 0 Max length: 40 | Optional | City of birth |
| String Max Length: 3 | Conditionally | Country of birth (ISO alpha-3 code) NOTE: For a full list of accepted birth.CountryCodes see ‘Reference Data API Module’ and the Retrieve Countries ISO3 endpoint: ] |
| String Max Length: 3 | Optional | Country of birth. (ISO alpha-3 code) |
| String | Optional | Occupation/Employment (Enumerated Value) NOTE: For a full list of accepted occupation codes see Reference Data Enumerations endpoint |
| Boolean | Optional | Flag to declare a Politically Exposed Person (PEP) |
| String Min Length: 3 Max Length: 3 | Optional | Country of citizenship (ISO alpha-3 code) |
| String Max length: 3 | Required | Type of identification document (Enumerated Value) NOTE: For a full list of accepted Identification documents by country. see Reference Data Enumerations endpoint |
| String Max length: 30 | Required | Identification document number |
| String Max length: 6 | Optional | Issuing state/province of identification document. |
| String Max Length: 3 | Required | Issuing country of identification document (ISO alpha-3 code) |
| String Length: 4 Format: YYYY | Optional | Expiration year of identification document (YYYY) |
| String Length: 2 Format: MM | Optional | Expiration month of identification document (MM) |
| String Length: 2 Format: DD | Optional | Expiration month of identification document (DD) |
| String Min length: 0 Max length: 30 | Optional | Issuing authority of identification document |
| String Min length: 0 Max length: 40 | Optional | Issuing city of identification document |
| String Length: 4 Format: YYYY | Optional | Issuing year of identification document (YYYY) |
| String Length: 2 Format: MM | Optional | Issuing month of identification document (MM) |
| String Length: 2 Format: DD | Optional | Issuing day of identification document (DD) |
| String Max length: 3 | Optional | Type of identification document (Enumerated Value) |
| String Max length: 30 | Optional | Identification document number |
| String Max length: 6 | Optional | Issuing state/province of identification document. |
| String Max length: 3 | Required | Issuing country of identification document. (ISO alpha-3 code) |
| String Length: 4 Format: YYYY | Optional | Expiration year of identification document (YYYY) |
| String Length: 2 Format: MM | Optional | Expiration month of identification document (MM) |
| String Length: 2 Format: DD | Optional | Expiration month of identification document (DD) |
| String Min length: 0 Max length: 30 | Optional | Issuing authority of identification document |
| String Min length: 0 Max length: 40 | Optional | Issuing city of identification document |
| String Length: 4 Format: YYYY | Optional | Issuing year of identification document (YYYY) |
| String Length: 4 Format: MM | Optional | Issuing month of identification document (MM) |
| String Length: 4 Format: DD | Optional | Issuing day of identification document (DD) |
| String Min length: 1 Max length: 20 | Required | First Name |
| String Min length: 0 Max length: 20 | Optional | Middle Name (if applicable) |
| String Min length: 1 Max length: 30 | Required | Last Name |
| String Min length: 1 Max length: 30 | Optional | Second Last Name |
| Number Max length: 14 | Required | Transaction amount and currency excluding fees and exchange rate. Transaction Currency (ISO alpha-3 code) For Crypto partners this is the fiat currency for the BUY/Sell or Ramp-on/Ramp-off |
| String | Required | The sendAmount.amount.value currency code (ISO alpha-3 code) |
| Number Min length: 0 Max length: 14 | Required | Fee Amount and Fee Currency applied to transaction (Fee currencyCode uses ISO alpha-3 code) |
| String | Required | Value's Currency code (ISO alpha-3 code) |
| Number Min length: 0 Max length: 14 | Conditionally Required | Tax Amount and Tax Currency applied to the Transaction by the the origin country |
| Sting | Conditionally Required | Value's Currency code (ISO alpha-3 code) |
| String | Conditionally Required | Type Code to indicate if the fee or tax is to be collected by MoneyGram or the partner |
| String | Conditionally Required | Consumer facing label name to identify the charge type |
| Number | Conditionally Required | Additional fee or tax amount |
| String | Conditionally Required | The |
| String | Optional | Transaction discount amount applied and currency type excluding fees and exchange rate. Transaction discount currencyCode (ISO alpha-3 code) |
| String | Optional | Additional Details about the applied promotion to the transaction. currencyCode (ISO alpha-3 code) |
| Number Max length 14 | Required | Transaction Total Amount including fees, taxes and discount. |
| String | Required | the |
| Number Max length: 14 | Required | Transaction receive amount |
| String | Required | the |
| Number Max length: 14 | Optional | Receive fee by the destination country. |
| String | Optional | The |
| Number Max length: 14 | Optional | Tax Amount applied to the Transaction by the the origin country |
| String | Optional | The |
| String | Optional | Type code to indicate if the fee or tax is to be collected by MoneyGram or the partner |
| String | Optional | Consumer facing label name to identify the charge type |
| Number Max length: 14 | Optional | Additional fee or tax amount |
| String | Optional | The |
| Number Max length: 14 | Required | Receive Amount Total and Receive Transaction Currency to be picked-up/deposited in destination country including fees, taxes and discount |
| String | Required | The |
| Number Max length: 6 | Required | Fx Rate applied to transaction |
| Boolean | Optional | Indicates whether the Fx is “estimated” and amount, taxes and total cannot be guaranteed. The word “estimated” must appear before receiveAmount.amount, receiveAmount.fees, receiveAmount.taxes and receiveAmount.total only when true. |
| Dynamic | Optional | Dynamic field key/values |
| String | Optional | Unique identifier for Target Account Resource |
| String | Optional | Receipt image string of the transacting partner |
| String | Optional | Funding method, based on enumerations |
| String | Optional | Name of the payment provider |
| String | Optional | Providers unique network identifier code |
| String | Optional | Account number of payment source |
| String | Optional | MoneyGrams unique identifier for the consumer account |
Updated about 20 hours ago
