当前位置: 首页 > 知识库问答 >
问题:

PHP莫利支付经常性账单

劳彦
2023-03-14

我的代码是:

$customer = $mollie->customers->create([
    "name"    => $name,
    "email"   => $email,
]);

$customer->createSubscription([
    "amount"          => [
            "currency"    => 'USD',
            "value"       => 20.00,
    ],
    "interval"        => '2months',
    "times"           => 3,
    "description"     => $someDescription,
    "webhookUrl"      => $webhook,
    "method"          => NULL,
]);

$payment = $customer->createPayment([
    "amount" => [
            "currency"    => 'USD',
            "value"       => 20.00,
    ],
    "description"     => $someDescription,
    "redirectUrl"     => $siteUrl,
    "webhookUrl"      => $webhook,
    "metadata" => [
        "order_id" => $orderId,
    ],
    "sequenceType" => \Mollie\Api\Types\SequenceType::SEQUENCETYPE_FIRST,
]);

结果是:

致命错误:未捕获异常'Mollie\Api\Exceptions\ApiExc0019',消息'执行API调用错误(422:不可处理实体):没有找到适合客户的任务。字段: CusterId.

我错过了什么吗??

共有3个答案

金兴朝
2023-03-14

在创建订阅之前,您必须创建任务

陈业
2023-03-14

我找到了一个关于我自己问题的答案:为了为用户添加订阅,您必须首先添加付款,然后再添加订阅。

        $customer = $mollie->customers->create([
            "name"    => $fullName,
            "email"   => $email,
        ]);

        $payment = $customer->createPayment([
            "amount" => [
                "currency"    => $currency,
                "value"       => $amount,
            ],
            "description"     => $description,
            "redirectUrl"     => $siteUrl,
            "webhookUrl"      => $webhook,
            "metadata" => [
                "order_id" => $orderId,
            ],
            "sequenceType" => \Mollie\Api\Types\SequenceType::SEQUENCETYPE_FIRST,
        ]);

        $customer->createSubscription([
            "amount"      => [
                "currency"    => $currency,
                "value"       => $amount,
            ],
            "times"       => $recurringLimit,
            "interval"    => $interval,
            "description" => $description,
            "webhookUrl"  => $webhook,
            "method"      => NULL,
        ]);
柯唯
2023-03-14

您缺少以前创建的客户的客户ID。

    $payment = $customer->createPayment([
        "customerId"      => $customer->id, /* see #3 in documentation */
        "amount" => [
                "currency"    => 'USD',
                "value"       => 20.00,
        ],
        "description"     => $someDescription,
        "redirectUrl"     => $siteUrl,
        "webhookUrl"      => $webhook,
        "metadata" => [
            "order_id" => $orderId,
        ],
        "sequenceType" => \Mollie\Api\Types\SequenceType::SEQUENCETYPE_FIRST,
    ]);
 类似资料:
  • 我试图在我的网站上与Onmipay Mollie和Barryvdh Laravel Omnipay建立一个支付系统 当我想付款时,提交用于付款的表格。我得到一个错误: 我的路由文件: 和我的PurchaseController: Paymenturl视图: 有什么东西不见了吗?我整个周末都在忙这个,但没有成功。有人能告诉我出了什么事吗? 仅供参考:我正在本地主机上执行此操作。不知道这是否有问题(不

  • 说明 alipay.fund.trans.toaccount.transfer(单笔转账到支付宝账户接口) 官方文档:https://docs.open.alipay.com/api_28/alipay.fund.trans.toaccount.transfer/ 类 请求参数类 请求参数 类名:\Yurun\PaySDK\AlipayApp\Fund\Transfer\Request 属性 名称

  • 说明 用于线下按日期拉取线上所有在线支付流水,进行对账 请求地址 http://api.dc78.cn/Api/cash_paylist 请求方式 GET 请求参数 date=20160804 返回 { "status": "1", "list": [ { "payid": "1072127", "date": "20160804", "remark": "刷卡账单-0000", "table":

  • 用于线下按日期拉取线上所有在线支付流水,进行对账 请求参数说明 参数 描述 必填 示例值 类型 最大长度 action 接口参数组 是 object └action 需要调用的接口名称 是 cash_paylist string get GET参数组,本组参数需要参与签名 是 object └date 日期 否 20200109 number 请求示例 { "action": { "acti

  • 本文向大家介绍Java实现支付宝之第三方支付宝即时到账支付功能,包括了Java实现支付宝之第三方支付宝即时到账支付功能的使用技巧和注意事项,需要的朋友参考一下 alipay 的几个内核功能文件: AlipayFunction.java AlipayNotify.java AlipayService.java Md5Encrypt.java AlipayConfig.java这里是对账号,Key,回