opennodedev / opennode-php

OpenNode PHP library for API v1
https://opennode.co/docs
MIT License
16 stars 5 forks source link

Understanding fiat_value in Charge::find #2

Open rvelhote opened 5 years ago

rvelhote commented 5 years ago

Hello,

I am working on a Magento 1.9 module and I am puzzled by the output of Charge::find regarding the fiat_value member.

I created a charge with the following parameters:

object(stdClass)[328]
  public 'description' => string '1xTest Product' (length=14)
  public 'amount' => float 104.99
  public 'currency' => string 'USD' (length=3)
  public 'order_id' => string '100000064' (length=9)
  public 'email' => string 'r@v.com' (length=7)
  public 'name' => string 'R V' (length=3)
  public 'callback_url' => string 'http://localhost/index.php/opennode_bitcoin/callback/index/' (length=59)
  public 'auto_settle' => string '1'

and when invoking Charge::find I get the following (removed some information to be brief):

private 'charge' => 
    array (size=13)
      'id' => string 'aa642947-5e5d-41c3-af16-3b40586ec88c' (length=36)
      'description' => string '1xTest Product' (length=14)
      'amount' => int 2703433
      'status' => string 'unpaid' (length=6)
      'fiat_value' => float 92.328199187348
      'currency' => string 'USD' (length=3)
      'created_at' => int 1545492242
      'order_id' => string '100000064' (length=9)
      'success_url' => string 'https://opennode.co' (length=19)
      'auto_settle' => boolean false

I created the charge with 104.99 USD and got back 92.32 USD. IS it a bug in the value returned by the API or is it some undocumented nuance?

Thank you, Ricardo

joaodealmeida commented 5 years ago

Hello @rvelhote ,

The fiat_value you received is the value of the checkout in your account's FIAT, which is probably EUR. Thanks for letting us know, I'll add the "source_fiat_value" to the response, which is the actual value you passed in USD.