const resultToken = 'eyJhbGciOiJIUzI1NiIs...'; // from client after payment
const response = await fetch('https://api.orchestrasolutions.com/EWalletOperations/validateResults', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify(resultToken)
});
const data = await response.json();
if (data.failedUpgChargeResults?.length) {
console.log('Payment failed:', data.failedUpgChargeResults[0].operationResultDescription);
} else if (data.upgChargeResults) {
console.log('Payment confirmed via gateway:', data.upgChargeResults.gatewayName);
console.log('Reference:', data.upgChargeResults.gatewayReference);
} else if (data.directChargeResults) {
console.log(data.directChargeResults.success ? 'Payment confirmed' : 'Payment failed:', data.directChargeResults.message);
} else if (data.tokenAndMaskedCardModel) {
console.log('Card tokenized:', data.tokenAndMaskedCardModel.token);
}
import requests
import json
result_token = 'eyJhbGciOiJIUzI1NiIs...' # from client after payment
response = requests.post(
'https://api.orchestrasolutions.com/EWalletOperations/validateResults',
headers={
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
data=json.dumps(result_token)
)
data = response.json()
if data.get('failedUpgChargeResults'):
print('Payment failed:', data['failedUpgChargeResults'][0]['operationResultDescription'])
elif data.get('upgChargeResults'):
print('Payment confirmed via gateway:', data['upgChargeResults']['gatewayName'])
print('Reference:', data['upgChargeResults']['gatewayReference'])
elif data.get('directChargeResults'):
print('Payment confirmed' if data['directChargeResults']['success'] else 'Payment failed:', data['directChargeResults']['message'])
elif data.get('tokenAndMaskedCardModel'):
print('Card tokenized:', data['tokenAndMaskedCardModel']['token'])
{
"upgChargeResults": {
"authorizationCode": "<string>",
"currency": "AFN",
"amount": 123,
"operationType": "Charge",
"operationResultCode": "Success",
"operationResultDescription": "<string>",
"customGatewayResponse": null,
"gatewayName": "<string>",
"gatewayReference": "<string>",
"gatewayResultCode": "<string>",
"gatewayResultDescription": "<string>",
"gatewayResultSubCode": "<string>",
"gatewayResultSubDescription": "<string>",
"gatewayToken": null,
"rejectReasonCode": "None"
},
"directChargeResults": {
"success": true,
"message": "<string>",
"data": null
},
"tokenAndMaskedCardModel": {
"bankCard": {
"type": "Unspecified",
"nameOnCard": "<string>",
"issueNumber": "<string>",
"ownerId": "<string>",
"securityCode": "<string>",
"number": "<string>",
"expirationMonth": 123,
"expirationYear": 123
},
"threeDS": {
"authenticationValue": "<string>",
"eci": "<string>",
"xid": "<string>",
"version": "<string>",
"sli": "<string>",
"acsTransactionId": "<string>",
"universal_TransactionId": "<string>",
"eWallet": "ApplePay",
"deviceManufacturerId": "<string>"
},
"errorMessage": "<string>",
"token": "<string>",
"tokenLocation": "<string>"
},
"failedUpgChargeResults": [
{
"authorizationCode": "<string>",
"currency": "AFN",
"amount": 123,
"operationType": "Charge",
"operationResultCode": "Success",
"operationResultDescription": "<string>",
"customGatewayResponse": null,
"gatewayName": "<string>",
"gatewayReference": "<string>",
"gatewayResultCode": "<string>",
"gatewayResultDescription": "<string>",
"gatewayResultSubCode": "<string>",
"gatewayResultSubDescription": "<string>",
"gatewayToken": null,
"rejectReasonCode": "None"
}
]
}[
{
"fieldName": "<string>",
"errors": [
"<string>"
]
}
]Payments Library
Validates and decrypts the result token returned by the Payments Library after a payment completes. Always call this endpoint from your server before fulfilling orders to confirm the payment was successful and the amount matches your records. The response contains the full transaction details including PSP references, authorization codes, and any tokenized card data.
POST
/
EWalletOperations
/
validateResults
const resultToken = 'eyJhbGciOiJIUzI1NiIs...'; // from client after payment
const response = await fetch('https://api.orchestrasolutions.com/EWalletOperations/validateResults', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify(resultToken)
});
const data = await response.json();
if (data.failedUpgChargeResults?.length) {
console.log('Payment failed:', data.failedUpgChargeResults[0].operationResultDescription);
} else if (data.upgChargeResults) {
console.log('Payment confirmed via gateway:', data.upgChargeResults.gatewayName);
console.log('Reference:', data.upgChargeResults.gatewayReference);
} else if (data.directChargeResults) {
console.log(data.directChargeResults.success ? 'Payment confirmed' : 'Payment failed:', data.directChargeResults.message);
} else if (data.tokenAndMaskedCardModel) {
console.log('Card tokenized:', data.tokenAndMaskedCardModel.token);
}
import requests
import json
result_token = 'eyJhbGciOiJIUzI1NiIs...' # from client after payment
response = requests.post(
'https://api.orchestrasolutions.com/EWalletOperations/validateResults',
headers={
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
data=json.dumps(result_token)
)
data = response.json()
if data.get('failedUpgChargeResults'):
print('Payment failed:', data['failedUpgChargeResults'][0]['operationResultDescription'])
elif data.get('upgChargeResults'):
print('Payment confirmed via gateway:', data['upgChargeResults']['gatewayName'])
print('Reference:', data['upgChargeResults']['gatewayReference'])
elif data.get('directChargeResults'):
print('Payment confirmed' if data['directChargeResults']['success'] else 'Payment failed:', data['directChargeResults']['message'])
elif data.get('tokenAndMaskedCardModel'):
print('Card tokenized:', data['tokenAndMaskedCardModel']['token'])
{
"upgChargeResults": {
"authorizationCode": "<string>",
"currency": "AFN",
"amount": 123,
"operationType": "Charge",
"operationResultCode": "Success",
"operationResultDescription": "<string>",
"customGatewayResponse": null,
"gatewayName": "<string>",
"gatewayReference": "<string>",
"gatewayResultCode": "<string>",
"gatewayResultDescription": "<string>",
"gatewayResultSubCode": "<string>",
"gatewayResultSubDescription": "<string>",
"gatewayToken": null,
"rejectReasonCode": "None"
},
"directChargeResults": {
"success": true,
"message": "<string>",
"data": null
},
"tokenAndMaskedCardModel": {
"bankCard": {
"type": "Unspecified",
"nameOnCard": "<string>",
"issueNumber": "<string>",
"ownerId": "<string>",
"securityCode": "<string>",
"number": "<string>",
"expirationMonth": 123,
"expirationYear": 123
},
"threeDS": {
"authenticationValue": "<string>",
"eci": "<string>",
"xid": "<string>",
"version": "<string>",
"sli": "<string>",
"acsTransactionId": "<string>",
"universal_TransactionId": "<string>",
"eWallet": "ApplePay",
"deviceManufacturerId": "<string>"
},
"errorMessage": "<string>",
"token": "<string>",
"tokenLocation": "<string>"
},
"failedUpgChargeResults": [
{
"authorizationCode": "<string>",
"currency": "AFN",
"amount": 123,
"operationType": "Charge",
"operationResultCode": "Success",
"operationResultDescription": "<string>",
"customGatewayResponse": null,
"gatewayName": "<string>",
"gatewayReference": "<string>",
"gatewayResultCode": "<string>",
"gatewayResultDescription": "<string>",
"gatewayResultSubCode": "<string>",
"gatewayResultSubDescription": "<string>",
"gatewayToken": null,
"rejectReasonCode": "None"
}
]
}[
{
"fieldName": "<string>",
"errors": [
"<string>"
]
}
]const resultToken = 'eyJhbGciOiJIUzI1NiIs...'; // from client after payment
const response = await fetch('https://api.orchestrasolutions.com/EWalletOperations/validateResults', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify(resultToken)
});
const data = await response.json();
if (data.failedUpgChargeResults?.length) {
console.log('Payment failed:', data.failedUpgChargeResults[0].operationResultDescription);
} else if (data.upgChargeResults) {
console.log('Payment confirmed via gateway:', data.upgChargeResults.gatewayName);
console.log('Reference:', data.upgChargeResults.gatewayReference);
} else if (data.directChargeResults) {
console.log(data.directChargeResults.success ? 'Payment confirmed' : 'Payment failed:', data.directChargeResults.message);
} else if (data.tokenAndMaskedCardModel) {
console.log('Card tokenized:', data.tokenAndMaskedCardModel.token);
}
import requests
import json
result_token = 'eyJhbGciOiJIUzI1NiIs...' # from client after payment
response = requests.post(
'https://api.orchestrasolutions.com/EWalletOperations/validateResults',
headers={
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
data=json.dumps(result_token)
)
data = response.json()
if data.get('failedUpgChargeResults'):
print('Payment failed:', data['failedUpgChargeResults'][0]['operationResultDescription'])
elif data.get('upgChargeResults'):
print('Payment confirmed via gateway:', data['upgChargeResults']['gatewayName'])
print('Reference:', data['upgChargeResults']['gatewayReference'])
elif data.get('directChargeResults'):
print('Payment confirmed' if data['directChargeResults']['success'] else 'Payment failed:', data['directChargeResults']['message'])
elif data.get('tokenAndMaskedCardModel'):
print('Card tokenized:', data['tokenAndMaskedCardModel']['token'])
Related
Library Reference
Result parsing, data structures, and validation
Body
application/json
The result token (JWS) returned by the Payments Library after a completed payment. This is the raw JSON string from result.token - do not wrap it in an object. The token contains encrypted transaction details that Orchestra will decrypt and validate. Important: Send the token as a raw JSON string in the request body, not as a property of an object.
The body is of type string.