简体   繁体   English

MercadopagoSDK中设置货币的问题

[英]Problem when set currency in MercadopagoSDK

I'm using the Mercado pago API to get paid.我正在使用 Mercado pago API 来获得报酬。 The code itself is working normally, the problem is that I can not set a coin manually.代码本身运行正常,问题是我无法手动设置硬币。 He already creates the transaction with the local currency for the MercadoPago account I am using.他已经为我正在使用的 MercadoPago 帐户创建了使用当地货币的交易。

I tried to set the currency manually as follows: $payment->currency = "USD";我尝试手动设置货币如下: $payment->currency = "USD";

I used var_dump to see how it returned the payment object and he returned me: string(58) "The name of the following parameters is wrong : [currency]"我使用var_dump查看它如何返回支付对象,他返回给我:string(58)“以下参数的名称错误:[货币]”

When I do not put the coin the transaction is normally done and the $payment-> currency it returns is from my local currency in this case as I am in Brazil, it is the "BRL"当我不放入硬币时,交易通常会完成,并且它返回的 $payment-> 货币来自我在这种情况下的本地货币,因为我在巴西,它是“BRL”

<?php  
MercadoPago\SDK::setAccessToken("TEST-6879657297193510-042902-edae012a62c69ecf8d30230b8496817d-426624866");
//...
$payment = new MercadoPago\Payment();
$payment->transaction_amount = 168;
$payment->token = "ff8080814c11e237014c1ff593b57b4d";
$payment->description = "Small Cotton Shirt";
$payment->installments = 1;
$payment->payment_method_id = "visa";
$payment->currency = "USD";
$payment->payer = array(
"email" => "arlene_hermiston@bol.com.br"
);
// Save and posting the payment
$payment->save();
//...
// Print the payment status
echo var_dump($payment);
//...
?>

My questions is: is it possible to receive payments in other currencies with Mercado pago API?我的问题是:是否可以使用 Mercado pago API 以其他货币接收付款? and if yes how do xD如果是的话 xD 怎么办

Note: I already looked a lot in the documentation but I did not find anything if anyone can help me thank you very much注意:我已经在文档中看了很多,但我没有找到任何东西,如果有人可以帮助我,非常感谢

Edited.已编辑。

Yes, you can.是的你可以。 You should use currency_id instead of currency.您应该使用currency_id 而不是货币。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM