简体   繁体   English

mindbody-php-api用于存储信用卡付款?

[英]mindbody-php-api for stored credit card payment?

I am using mindbody api for payment, when I add my credit card detail then payment is successful but when I am using stored(existing) card for payment then it's given error : 我正在使用mindbody api进行付款,当我添加我的信用卡详细信息时,付款就可以成功,但是当我在使用存储(现有)卡进行付款时,会提示错误:

Card Authorization Failed mb.Core.BLL.Transaction failed validation Could not determine the type of credit card.

my code is: 我的代码是:

$shoppingCart = array(
                'ClientID' => $client_id,
                'Test' => false,
                'InStore' => true, //add by NIK
                'CartItems' => array(
                    'CartItem' => array(
                        'Quantity' => $product_qty,
                        'Item' => new SoapVar(
                            array('ID' => $product_id), SOAP_ENC_ARRAY, 'Service', 'http://clients.mindbodyonline.com/api/0_5'
                        ),
                        'DiscountAmount' => 0
                    )
                ),

                'Payments' => array(
                    'PaymentInfo' => new SoapVar(
                        array(
                            'LastFour'=>$clientCreditCard->LastFour,
                            'Amount'=>round($OnlinePrice, 2),
                        ),
                        SOAP_ENC_ARRAY,
                        'StoredCardInfo',
                        'http://clients.mindbodyonline.com/api/0_5'
                    ),
                )
            );

please give any solution for it, what should I do or send extra parameter. 请提供解决方案,该怎么办或发送额外的参数。 thanks! 谢谢!

Shouldn't it look more like this? 它不应该看起来像这样吗?

'Payments' => array(
        'PaymentInfo' => new SoapVar(
            array(
                'CreditCardNumber'=>'4111111111111111', 
                'ExpYear'=>'2015', 
                'ExpMonth'=>'06', 
                'Amount'=>'130', 
                'BillingAddress'=>'123 Happy Ln', 
                'BillingPostalCode'=>'93405'
            ), 
            SOAP_ENC_ARRAY, 
            'CreditCardInfo', 
            'http://clients.mindbodyonline.com/api/0_5'
        )

Taken from this README.md https://github.com/devincrossman/mindbody-php-api 取自此README.md https://github.com/devincrossman/mindbody-php-api

Your shopping cart array with saved card is correctly constructed. 带有已保存卡的购物车阵列已正确构造。

I've been struggling with exactly the same problem for the last few days, and I found that the error in my case was that the front end account page was passing the credit card number with spaces in the string - the front end form was automatically adding the spaces for the usual format/usability reasons in the admin part of the application where the saved card details are entered. 最近几天,我一直在努力解决完全相同的问题,我发现我的错误是前端帐户页面正在通过字符串中的空格传递信用卡号-前端表单是自动生成的出于通常的格式/可用性原因,在输入已保存卡详细信息的应用程序的admin部分中添加空格。

I solved it by stripping out the spaces in PHP : str_replace(" ", "", $_POST['cardnumber']) in the card save function. 我通过在卡保存功能中删除PHP中的空格来解决它:str_replace(“”,“”,$ _POST ['cardnumber'])。

Once I did that the saved card payment process worked fine. 一旦我做了,保存的卡支付过程就可以正常工作了。

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

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