FX Optimizer
Server-Side Implementation
Important
Your integration may be impacted by upcoming certificate changes. Visit our best practices guide to learn more.
Creating a transaction
When creating a transaction, pass the exchangeRateQuoteId
from the PHP SDK.
The Exchange Rate Quote API is a GraphQL API, and the server-side implementation includes converting the below request passed to the API.
The client-side makes a request by passing the following variables:
- PHP
$variables = [
"quotes" => [
"baseCurrency" => "USD",
"quoteCurrency" => "EURC",
"baseAmount" => "12.19",
"markup" => "1.89",
],
];
$request = ExchangeRateQuoteRequest::factory($variables);
and invoking the API:
- PHP
$response = $gateway->exchangeRateQuote()->generate($request);
the response:
- PHP
$result = $gateway->transaction()->sale([
'amount' => '10.00',
'paymentMethodNonce' => $nonceFromTheClient,
'deviceData' => $deviceDataFromTheClient,
'exchangeRateQuoteId' => $exchangeRateQuoteIdFromTheClient,
'options' => ['submitForSettlement' => True]
]);