简体   繁体   English

将新信用卡添加到Paypal定期付款资料

[英]Add a new credit card to paypal recurring payment profile

I have a feature in my website that a user can change/update/add a credit card in his/her Paypal recurring payment profile. 我的网站上有一个功能,用户可以在其Paypal定期付款资料中更改/更新/添加信用卡。 But while updating the profile nothing happens. 但是,在更新配置文件时,没有任何反应。 Please help. 请帮忙。 Code is as below: 代码如下:

require_once("paypal_pro.inc.php");
$paypalPro = new paypal_pro('xxxxxxxxxxxxxxxxxxxxx.gmail.com', 'xxxxxxxxxxxxxx', 'xxxxxxxxxxxxxxxxxxxxxxxxxxx', '', '', FALSE, FALSE );
$paymentAction = urlencode("Sale");
$methodToCall = 'UpdateRecurringPaymentsProfile';
$padDateMonth = str_pad(4, 2, '0', STR_PAD_LEFT);
$expDateYear =urlencode( 2018);      
$expDate = $padDateMonth.$expDateYear;
$nvpstr='&PAYMENTACTION='.$paymentAction.'&METHOD=UpdateRecurringPaymentsProfile&PROFILEID=I-NGYJW5L1TLNV&CREDITCARDTYPE=VISA&ACCT=4111111111111111&CVV2=123&EXPDATE='.$expDate;
$resArray = $paypalPro->hash_call($methodToCall,$nvpstr);
echo '<pre>';
print_r($resArray);

I am trying this with a sandbox account. 我正在使用沙盒帐户尝试此操作。

First of all you need to tell where are you writing this code. 首先,您需要告诉您在哪里编写此代码。 Don't mind but your code looks like not as it should be: 1- Which version are you using (Yii1 | Yii2)? 没关系,但是您的代码看起来不应该是:1-您正在使用哪个版本(Yii1 | Yii2)? I guess Yii1 我猜Yii1

if you are using yii1 and you want to perform this stuff under profile update Action. 如果您使用的是yii1,并且想在配置文件更新操作下执行此操作。

so lets consider "profile/update" Action. 因此,让我们考虑“配置文件/更新”操作。 so there will be some thing like below under "ProfileController". 因此,在“ ProfileController”下将出现类似下面的内容。

public function actionUpdate(){
//some thing will be placed here....
}

There are 2 ways to do it. 有两种方法可以做到这一点。 one just do it along with the controller or user Hooks (recommended) so it will be under "Model afterSave" hook. 只需将其与控制器或用户的Hooks一起使用(推荐),使其位于“ Model afterSave”钩子下。 some thing like that. 这样的事情。 you can use any extension / component / widget. 您可以使用任何扩展名/组件/小部件。

Paypal Extension can tell you how you can do it . 贝宝扩展程序可以告诉您如何进行。

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

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