PAYPAL IPN自定义字段缺失(PAYPAL IPN custom field missing)

2019-08-16 18:40发布

我现在面临实现与API进程和沙箱宝定期付款的麻烦。 我成功创建预订按钮,将用户重定向到PayPal快速结帐页面。 但是,自定义字段中缺少贝宝产生了一些IPN,我真的需要这个领域。

下面是我在生成的订阅按钮发送请求:

METHOD=SetExpressCheckout
&VERSION=94.0
&PWD=123456
&USER=myEmail@biz.com
&SIGNATURE=mySignature
&PAYMENTREQUEST_0_AMT=5.00
&PAYMENTREQUEST_0_PAYMENTACTION=Sale
&PAYMENTREQUEST_0_CURRENCYCODE=EUR
&RETURNURL=http%3A%2F%2Fwww.myWebSite.com?ok
&CANCELURL=http%3A%2F%2Fwww.myWebSite.com?ko
&L_BILLINGTYPE0=RecurringPayments
&L_BILLINGAGREEMENTDESCRIPTION0=test+paypal
&REQCONFIRMSHIPPING=0
&NOSHIPPING=1
&L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital
&L_PAYMENTREQUEST_0_NAME0=test+paypal
&L_PAYMENTREQUEST_0_AMT0=5.00
&L_PAYMENTREQUEST_0_QTY0=1
&PAYMENTREQUEST_0_CUSTOM=custom_var1%3Dvalue1%7Ccustom_var2%3Dvalue2

用户确认交易完成后,他回来我的网站,我需要验证信息,并建立定期PROFIL。 下面是我的要求:

METHOD=GetExpressCheckoutDetails
&VERSION=94.0
&PWD=123456
&USER=myEmail@biz.com
&SIGNATURE=mySignature
&TOKEN=theToken


METHOD=CreateRecurringPaymentsProfile
&VERSION=94.0
&PWD=123456
&USER=myEmail@biz.com
&SIGNATURE=mySignature
&TOKEN=theToken
&AMT=5.00
&CURRENCYCODE=EUR
&PROFILESTARTDATE=2013-02-04T15%3A16%3A24%2B01%3A00
&BILLINGPERIOD=Day
&BILLINGFREQUENCY=1
&DESC=test+paypal


METHOD=DoExpressCheckoutPayment
&VERSION=94.0
&PWD=123456
&USER=myEmail@biz.com
&SIGNATURE=mySignature
&TOKEN=theToken
&PAYERID=JZUVX4TAHRHRU
&PAYMENTREQUEST_0_PAYMENTACTION=Sale
&PAYMENTREQUEST_0_AMT=5.00
&PAYMENTREQUEST_0_CURRENCYCODE=EUR
&PAYMENTREQUEST_0_NOTIFYURL=http%3A%2F%2Fwww.myWebSite.com?notify
&PAYMENTREQUEST_0_CUSTOM=custom_var1%3Dvalue1%7Ccustom_var2%3Dvalue2

这样做之后,我收到这些IPN:

Array
(
    [transaction_subject] => test paypal
    [payment_date] => 06:01:52 Feb 04, 2013 PST
    [txn_type] => express_checkout
    [last_name] => numerik
    [residence_country] => FR
    [item_name] => 
    [payment_gross] => 
    [mc_currency] => EUR
    [payment_type] => instant
    [protection_eligibility] => Ineligible
    [verify_sign] => myVerifySign
    [payer_status] => verified
    [test_ipn] => 1
    [tax] => 0.00
    [payer_email] => myEmail@per.com
    [txn_id] => 6XC11065S3796804E
    [quantity] => 1
    [receiver_email] => myEmail@biz.com
    [first_name] => buyer
    [payer_id] => myPayerId
    [receiver_id] => myReceiverId
    [item_number] => 
    [handling_amount] => 0.00
    [payment_status] => Completed
    [payment_fee] => 
    [mc_fee] => 0.42
    [shipping] => 0.00
    [mc_gross] => 5.00
    [custom] => custom_var1=value1|custom_var2=value2
    [charset] => windows-1252
    [notify_version] => 3.7
    [ipn_track_id] => ab76ea3421261
)

Array
(
    [payment_cycle] => Daily
    [txn_type] => recurring_payment_profile_created
    [last_name] => numerik
    [next_payment_date] => 02:00:00 Feb 04, 2013 PST
    [residence_country] => FR
    [initial_payment_amount] => 0.00
    [currency_code] => EUR
    [time_created] => 06:01:47 Feb 04, 2013 PST
    [verify_sign] => myVerifySign
    [period_type] =>  Regular
    [payer_status] => verified
    [test_ipn] => 1
    [tax] => 0.00
    [payer_email] => myEmail@per.com
    [first_name] => buyer
    [receiver_email] => myEmail@biz.com
    [payer_id] => myPayerId
    [product_type] => 1
    [shipping] => 0.00
    [amount_per_cycle] => 5.00
    [profile_status] => Active
    [charset] => windows-1252
    [notify_version] => 3.7
    [amount] => 5.00
    [outstanding_balance] => 0.00
    [recurring_payment_id] => myRecurringPaymentId
    [product_name] => test paypal
    [ipn_track_id] => a8adfdf8b61d3
)

正如你在第一次看到IPN领域的习俗是可用,但不是在第二个。 有谁知道我错过了在第2 IPN检索的自定义字段?

Answer 1:

您DoExpressCheckoutPayment请求包括自定义参数这就是为什么你要回该事务。 您CreateRecurringPaymentsProfile请求不具有自定义参数包括在内,所以它不会回来。

这就是说,它看起来并不像自定义参数可用于CRPP所以你需要在本地保存数据,包括当地的记录ID在你CRPP请求PROFILEREFERENCE参数中。 这样,它会回来的IPN作为rp_invoice_id像马特·科尔的建议,并可以相应地使用记录ID拉你的自定义数据回你的数据库。



Answer 2:

最好的办法是增加PROFILEREFERENCE到您的通话CreateRecurringPaymentsProfile。 它将在IPN回来为rp_invoice_id



文章来源: PAYPAL IPN custom field missing