Payum provides ability to get currency details listed in ISO4217 specification. To get this information you have to execute a GetCurrency request with a currency code.
<?phpusePayum\Core\Request\GetCurrency;$factory =new\Payum\Offline\OfflineGatewayFactory();$gateway = $factory->create();$gateway->execute($currency =newGetCurrency('USD'));echo $currency->getAlpha3(); // USDecho $currency->getName(); // US Dollarecho $currency->getExp(); // 2echo $currency->getCountry(); // US// and so on...
Or inside another action:
<?phpusePayum\Core\Action\ActionInterface;usePayum\Core\GatewayAwareInterface;usePayum\Core\GatewayAwareTrait;usePayum\Core\Request\GetCurrency;classFooActionimplementsActionInterface,GatewayAwareInterface{useGatewayAwareTrait;publicfunctionexecute($request) {$this->gateway->execute($currency =newGetCurrency('USD'));echo $currency->getAlpha3(); // USDecho $currency->getName(); // US Dollarecho $currency->getExp(); // 2echo $currency->getCountry(); // US }}
Or directly ISO4217 service:
<?phpusePayum\Core\ISO4217\Currency;$currency =Currency::createFromIso4217Alpha3('USD');echo $currency->getAlpha3(); // USDecho $currency->getName(); // US Dollarecho $currency->getExp(); // 2echo $currency->getCountry(); // US
Payum is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider: