dongzhi1851 2014-09-15 05:52
浏览 120
已采纳

经常付款不使用braintree中的PayPal按钮

I am using a PayPal button in my HTML Form. All works fine like PayPal ask for authentication and inject the payment_method_nonce in HTML form.

But, When i creating a subscription with this payment_method_nonce then its give me error that:- Message:- Payment method token is invalid Code:- 91903

I am using PHP Library and Here is my code snippet:-

$subscription = Braintree_Subscription::create(array(
    'paymentMethodToken' => payment_method_nonce that PayPal button inject in my form,
    'planId' => planId that created in Braintree,   
));

or if i use sale method using same payment_method_nonce like this:-

$subscription = Braintree_Transaction::sale(array(
    'amount' => $amount,
    'paymentMethodToken' => payment_method_nonce that PayPal button inject in my form
));

than its works fine.

Please let me know what is the problem with this?

  • 写回答

1条回答 默认 最新

  • duanmibei1929 2014-09-16 16:15
    关注

    I work at Braintree. You can always get in touch with our support team if you need more help.

    Payment methods need to be vaulted before they can be used to create a subscription.

    In the case of a nonce that doesn't point to a vaulted payment method, you can use it to create one, and then use that to create the subscription. (We'll update the docs to make this more clear.)

    $result = Braintree_Customer::create(array(
        'paymentMethodNonce' => $payment_method_nonce,
    ));
    
    $token = $result->customer->paypalAccounts[0]->token;
    
    $result = Braintree_Subscription::create(array(
      'paymentMethodToken' => $token,
      'planId' => 'planId that created in Braintree',
    ));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 echarts动画效果失效的问题。官网下载的例子。
  • ¥60 许可证msc licensing软件报错显示已有相同版本软件,但是下一步显示无法读取日志目录。
  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加