金额必须大于零,PayPal / Braintree付款

时间:2018-07-18 10:54:53

标签: php paypal sdk braintree

我有一个出售活动的应用程序,有些活动的价格为零美元。因此,我从PayPal收到此消息:

Amount must be greater than zero

但是,如果我不需要付款,则一个用户可以订购活动的所有门票。因此,怎样使用户无需付费即可完成付款过程。

请记住,从前端生成一个Nonce并将其发送到后端以进行收费方面,对流程进行尽可能少的更改是很好的。

我正在使用this付款方式。

这是返回错误消息的函数:

public function chargeNonce($nonce) {
    $gateway = $this->createPayPalGateway();
    $amount = $this->payment_params['number_of_tickets'] * $this->payment_params['event_price'];
    $result = $gateway->transaction()->sale([
      'amount' => $amount,
      'paymentMethodNonce' => $nonce,
      'options' => [
        'submitForSettlement' => True,
        'paypal' => [
            'description' => "Billing Notification",// For email receipt
        ],
      ],
    ]);

    dd($result);
    return $result;
}

0 个答案:

没有答案
相关问题