0

获取错误:遇到 PHP 错误

严重性:通知

消息:未定义的索引:ACK

文件名:controllers/contest.php

行号:1191

有时会在沙盒帐户中成功转移错误和金额,但贝宝没有返回响应数组,我的代码是

function payment($array) { //$this->session->set_userdata('contestArr',$array); $DPFields = array( 'paymentaction' => 'Sale', // 您希望如何获得付款。授权表示付款是基本身份验证,需要通过 Auth & Capture 进行结算。Sale 表示这是您的最终销售正在请求付款。默认为销售。'ipaddress' => $_SERVER['REMOTE_ADDR'], // 必填。付款人浏览器的 IP 地址。'returnfmfdetails' => '1' // 判断是否要结果的标志由 FMF 返回。1 或 0。默认为 0。);

    $CCDetails = array(
                        'creditcardtype' => $array['cardtype'],                      // Required. Type of credit card.  Visa, MasterCard, Discover, Amex, Maestro, Solo.  If Maestro or Solo, the currency code must be GBP.  In addition, either start date or issue number must be specified.
                        'acct' => $array['cardno'],                        // Required.  Credit card number.  No spaces or punctuation.  
                        'expdate' => $array['ccmnth'].$array['ccyear'],                         // Required.  Credit card expiration date.  Format is MMYYYY
                        'cvv2' => $array['cvv'],                        // Requirements determined by your PayPal account settings.  Security digits for credit card.
                        'startdate' => '',                          // Month and year that Maestro or Solo card was issued.  MMYYYY
                        'issuenumber' => ''                         // Issue number of Maestro or Solo card.  Two numeric digits max.
                    );

    $PayerInfo = array(
                        'email' => 'surend_1296637287_per@contentshoppe.com',                               // Email address of payer.
                        'payerid' => '',                            // Unique PayPal customer ID for payer.
                        'payerstatus' => '',                        // Status of payer.  Values are verified or unverified
                        'business' => 'NeedAJingle'                             // Payer's business name.
                    );

    $PayerName = array(
                        'salutation' => '',                     // Payer's salutation.  20 char max.
                        'firstname' => $array['payer_fname'],                   // Payer's first name.  25 char max.
                        'middlename' => '',                         // Payer's middle name.  25 char max.
                        'lastname' => $array['payer_lname'],                            // Payer's last name.  25 char max.
                        'suffix' => ''                              // Payer's suffix.  12 char max.
                    );

    $BillingAddress = array(
                            'street' => '123 Test Ave.',                        // Required.  First street address.
                            'street2' => '',                        // Second street address.
                            'city' => 'Kansas City',                            // Required.  Name of City.
                            'state' => 'MO',                            // Required. Name of State or Province.
                            'countrycode' => 'US',                  // Required.  Country code.
                            'zip' => '64111',                           // Required.  Postal code of payer.
                            'phonenum' => '555-555-5555'                        // Phone Number of payer.  20 char max.
                        );

    $ShippingAddress = array(
                            'shiptoname' => '',                     // Required if shipping is included.  Person's name associated with this address.  32 char max.
                            'shiptostreet' => '',                   // Required if shipping is included.  First street address.  100 char max.
                            'shiptostreet2' => '',                  // Second street address.  100 char max.
                            'shiptocity' => '',                     // Required if shipping is included.  Name of city.  40 char max.
                            'shiptostate' => '',                    // Required if shipping is included.  Name of state or province.  40 char max.
                            'shiptozip' => '',                      // Required if shipping is included.  Postal code of shipping address.  20 char max.
                            'shiptocountry' => '',                  // Required if shipping is included.  Country code of shipping address.  2 char max.
                            'shiptophonenum' => ''                  // Phone number for shipping address.  20 char max.
                            );

    $PaymentDetails = array(
                            'amt' => round($array['gross_total'],2),                            // Required.  Total amount of order, including shipping, handling, and tax.  
                            'currencycode' => 'USD',                    // Required.  Three-letter currency code.  Default is USD.
                            'itemamt' => round($array['gross_total'],2),    // Required if you include itemized cart details. (L_AMTn, etc.)  Subtotal of items not including S&H, or tax.
                            'shippingamt' => '',                    // Total shipping costs for the order.  If you specify shippingamt, you must also specify itemamt.
                            'shipdiscamt' => '',                    // Shipping discount for the order, specified as a negative number.  
                            'handlingamt' => '',                    // Total handling costs for the order.  If you specify handlingamt, you must also specify itemamt.
                            'taxamt' => '',                         // Required if you specify itemized cart tax details. Sum of tax for all items on the order.  Total sales tax. 
                            'desc' => 'Add contest payment',                            // Description of the order the customer is purchasing.  127 char max.
                            'custom' => '',                         // Free-form field for your own use.  256 char max.
                            'invnum' => '',                         // Your own invoice or tracking number
                            'notifyurl' => ''                       // URL for receiving Instant Payment Notifications.  This overrides what your profile is set to use.
                        );  

    $OrderItems = array();
    $Item    = array(
                        'l_name' => substr($array['title'],0,100),                      // Item Name.127 char max.
                        'l_desc' => substr($array['headline'],0,100),                       // Item description.  127 char max.
                        'l_amt' => round($array['gross_total'],2),                          // Cost of individual item.
                        'l_number' => rand(2,2).'@-@'.rand(1,2),                        // Item Number.  127 char max.
                        'l_qty' => 1,                           // Item quantity.  Must be any positive integer.  
                        'l_taxamt' => '',                       // Item's sales tax amount.
                        'l_ebayitemnumber' => '',               // eBay auction number of item.
                        'l_ebayitemauctiontxnid' => '',         // eBay transaction ID of purchased item.
                        'l_ebayitemorderid' => ''               // eBay order ID for the item.
                );
    array_push($OrderItems, $Item);

    $Secure3D = array(
                      'authstatus3d' => '', 
                      'mpivendor3ds' => '', 
                      'cavv' => '', 
                      'eci3ds' => '', 
                      'xid' => ''
                      );

    $PayPalRequestData = array(
                            'DPFields' => $DPFields, 
                            'CCDetails' => $CCDetails, 
                            'PayerInfo' => $PayerInfo, 
                            'PayerName' => $PayerName, 
                            'BillingAddress' => $BillingAddress, 
                            'ShippingAddress' => $ShippingAddress, 
                            'PaymentDetails' => $PaymentDetails, 
                            'OrderItems' => $OrderItems, 
                            'Secure3D' => $Secure3D
                        );

    $PayPalResult = $this->paypal_pro->DoDirectPayment($PayPalRequestData);

    //print_r($PayPalResult);



    if(!$this->paypal_pro->APICallSuccessful($PayPalResult['ACK']))
    {
        $errors = array('Errors'=>$PayPalResult['ERRORS']);
        $this->template->load('template','paypal_error',$errors);
        exit;
    }
    else
    {
        $data = array('PayPalResult'=>$PayPalResult);


    }

}

4

1 回答 1

0

您必须使用密钥Ack而不是ACK访问状态。

例子:$PayPalResult['Ack']

于 2013-03-14T18:21:19.493 回答