You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

已创建门店与POS,如何通过MercadoPago API生成100比索固定支付二维码?

生成Mercado Pago固定100比索的支付二维码

你已经完成门店和POS的创建流程,要生成仅支持100比索的固定金额支付二维码,只需在POS创建请求中添加固定金额参数即可,具体操作如下:

修改POS创建代码

在现有POS创建的请求数据里,新增amount字段并设置为100,同时确保fixed_amount保持true(启用固定金额模式)。修改后的PHP代码如下:

$data = array(
    "name" => "First POS",
    "fixed_amount" => true,
    "amount" => 100, // 指定固定金额为100比索
    "store_id" => $store_id,
    "external_store_id" => "SUC001",
    "external_id" => "SUC001POS001",
    "category" => $category
);

$data_string = json_encode($data);

$ch = curl_init('https://api.mercadopago.com/pos');

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "Authorization: Bearer ".$private_key,
    "Content-Type: application/json"
));

$result = curl_exec($ch);

curl_close($ch);

echo $result;

参数说明

  • fixed_amount: true:开启固定金额支付模式,用户无法修改支付金额
  • amount: 100:设置固定支付金额为100比索(Mercado Pago阿根廷站点默认货币为比索,无需额外指定货币代码)

已创建POS的更新方式

如果已经创建POS但未设置金额,可通过PUT请求更新参数:

  1. 从之前POS创建的返回结果中获取id(POS唯一标识)
  2. 发起PUT请求到https://api.mercadopago.com/pos/{POS_ID},请求体包含fixed_amount: true和amount: 100

示例更新代码:

$pos_id = "你的POS ID"; // 替换为实际POS ID
$url = "https://api.mercadopago.com/pos/".$pos_id;

$data = array(
    "fixed_amount" => true,
    "amount" => 100
);

$data_string = json_encode($data);

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "Authorization: Bearer ".$private_key,
    "Content-Type: application/json"
));

$result = curl_exec($ch);

curl_close($ch);

echo $result;

执行上述操作后,生成的二维码将仅支持用户支付100比索,无法修改金额。

内容的提问来源于stack exchange,提问作者Anton Sibgatulin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 09:03:16