订单摘要显示和付款摘要隐藏在paypal自适应支付

时间:2016-06-22 11:19:02

标签: php html paypal

我已经尝试过这段代码,但这对我不起作用,我需要快速结账和自适应付款,

我尝试了不同的方法,但在PayPal自适应支付无效的情况下添加订单摘要和付款摘要

function Pay()
{
    $PayRequestFields = array(
                            'ActionType' => 'PAY',                              // Required.  Whether the request pays the receiver or whether the request is set up to create a payment request, but not fulfill the payment until the ExecutePayment is called.  Values are:  PAY, CREATE, PAY_PRIMARY
                            'CancelURL' => site_url('paypal/adaptive_payments/pay_cancel'),                                     // Required.  The URL to which the sender's browser is redirected if the sender cancels the approval for the payment after logging in to paypal.com.  1024 char max.
                            'CurrencyCode' => 'AUD',                                // Required.  3 character currency code.
                            'FeesPayer' => 'EACHRECEIVER',                                  // The payer of the fees.  Values are:  SENDER, PRIMARYRECEIVER, EACHRECEIVER, SECONDARYONLY
                            'IPNNotificationURL' => '',                         // The URL to which you want all IPN messages for this payment to be sent.  1024 char max.
                            'Memo' => '',                                       // A note associated with the payment (text, not HTML).  1000 char max
                            'Pin' => '',                                        // The sener's personal id number, which was specified when the sender signed up for the preapproval
                            'PreapprovalKey' => '',                             // The key associated with a preapproval for this payment.  The preapproval is required if this is a preapproved payment.  
                            'ReturnURL' => site_url('paypal/adaptive_payments/pay_return'),                                     // Required.  The URL to which the sener's browser is redirected after approvaing a payment on paypal.com.  1024 char max.
                            'ReverseAllParallelPaymentsOnError' => '',          // Whether to reverse paralel payments if an error occurs with a payment.  Values are:  TRUE, FALSE
                            'SenderEmail' => '',                                // Sender's email address.  127 char max.
                            'TrackingID' => ''                                  // Unique ID that you specify to track the payment.  127 char max.
                            );

    $ClientDetailsFields = array(
                            'CustomerID' => '',                                 // Your ID for the sender  127 char max.
                            'CustomerType' => '',                               // Your ID of the type of customer.  127 char max.
                            'GeoLocation' => '',                                // Sender's geographic location
                            'Model' => '',                                      // A sub-identification of the application.  127 char max.
                            'PartnerName' => ''                                 // Your organization's name or ID
                            );

    $FundingTypes = array('ECHECK', 'BALANCE', 'CREDITCARD');

    $Receivers = array();
    $Receiver = array(
                    'Amount' => '25'
                    'Email' => 'a@b.com', 
                    // Receiver's email address. 127 char max.
                    'InvoiceID' => '',                                          // The invoice number for the payment.  127 char max.
                    'PaymentType' => '',                                        // Transaction type.  Values are:  GOODS, SERVICE, PERSONAL, CASHADVANCE, DIGITALGOODS
                    'PaymentSubType' => '',                                     // The transaction subtype for the payment.
                    'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => ''), // Receiver's phone number.   Numbers only.
                    'Primary' => ''                                             // Whether this receiver is the primary receiver.  Values are:  TRUE, FALSE
                    );
    array_push($Receivers,$Receiver);

    $Receiver = array(
                    'Amount' => '10',       
                    'Description' => 'asdfghj', 
                    // Required.  Amount to be paid to the receiver.
                    'Email' => 'b@c.com', 
                    // Receiver's email address. 127 char max.
                    'InvoiceID' => '',                                          // The invoice number for the payment.  127 char max.
                    'PaymentType' => '',                                        // Transaction type.  Values are:  GOODS, SERVICE, PERSONAL, CASHADVANCE, DIGITALGOODS
                    'PaymentSubType' => '',                                     // The transaction subtype for the payment.
                    'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => ''), // Receiver's phone number.   Numbers only.
                    'Primary' => ''                                             // Whether this receiver is the primary receiver.  Values are:  TRUE, FALSE
                    );
    array_push($Receivers,$Receiver);
    //print_r($Receivers);die;



    $SenderIdentifierFields = array(
                                    'UseCredentials' => ''                      // If TRUE, use credentials to identify the sender.  Default is false.
                                    );

    $AccountIdentifierFields = array(
                                    'Email' => '',                              // Sender's email address.  127 char max.
                                    'Phone' => array('CountryCode' => '', 'PhoneNumber' => '', 'Extension' => '')                               // Sender's phone number.  Numbers only.
                                    );

    $PayPalRequestData = array(
                        'PayRequestFields' => $PayRequestFields, 
                        'ClientDetailsFields' => $ClientDetailsFields, 
                        'FundingTypes' => $FundingTypes, 
                        'Receivers' => $Receivers, 
                        'SenderIdentifierFields' => $SenderIdentifierFields, 
                        'AccountIdentifierFields' => $AccountIdentifierFields
                        );  

    $PayPalResult = $this->paypal_adaptive->Pay($PayPalRequestData);

    if(!$this->paypal_adaptive->APICallSuccessful($PayPalResult['Ack']))
    {
        $errors = array('Errors'=>$PayPalResult['Errors']);
        $this->load->view('front/error',$errors);
    }
    else
    {
        // Successful call.  Load view or whatever you need to do here. 
        echo '<pre />';
        print_r($PayPalResult);
        echo '<p><a href="' . $PayPalResult['RedirectURL'] . '">PROCEED TO PAYPAL</a></p>';
    }
}

1 个答案:

答案 0 :(得分:0)

快速结账不使用自适应支付库。

您可以使用快速结帐API并提供与进行API调用的帐户ID(电子邮件)不同的PayPal卖家帐户ID。此配置允许在快速结账时进行并行付款(即使在重定向模式下),您可以控制订单总金额的哪个用户部分。

通过快速结账,控制购物车的细节非常简单。

文档的链接:https://developer.paypal.com/docs/classic/express-checkout/ht_ec-parallelPayments/