PayPal Using Payflow to create Recurring Payment w

2019-05-31 17:30发布

My clients don't want to handle credit card data so I have implemented 2 options, 1) PayPal Advanced with Hosted Pages, and 2) PayPal Pro Transparent redirect. I am able to create recurring payments by

  1. Getting my secure token
  2. Committing a transaction
  3. Converting transaction to Recurring Billing Profile

PayPal requires that I give the user the option to pay with a PayPal account but when I convert that payment to a RBP and then let it create a transaction the trans fails with result 7 - Field Format Error. I notice that the RBP created has no account number.

With option 1 I think I'm out of luck yes?

With option 2, I use Payflow.net dll to process the EC which works fine (see code sample). Is there a code sample somewhere on how to create a RBP with a token instead of a CC num or BAID?

...
partner = pageSettings.PageSettings["PayPalPartner"];
vendor = pageSettings.PageSettings["PayPalLogin"];
user = pageSettings.PageSettings["PayPalUser"];
pwd = Utilities.DecryptSettingValue(pageSettings.PageSettings["PayPalPassword"])
UserInfo creds = new UserInfo(user, vendor, partner, pwd);
string url = ConfigurationManager.AppSettings.Get("PayflowLive");
PayflowConnectionData connection = new PayflowConnectionData(url);
ECDoRequest doRequest = new ECDoRequest(token, payerID);
PayPalTender tender = new PayPalTender(doRequest);
Invoice inv = new Invoice();
inv.Amt = new Currency(amount, "USD");
inv.Comment1 = fundName;
SaleTransaction trans = new SaleTransaction(creds, connection, inv, tender, PayflowUtility.RequestId);
Response resp = trans.SubmitTransaction();

1条回答
霸刀☆藐视天下
2楼-- · 2019-05-31 17:47

I don't have the code but I can direct you on how you can create the recurring profile using the PayPal Payments . It includes the four steps :

1. Call the SetExpressCheckout API

VENDOR=XXXXXXX&PARTNER=XXXXXXX&USER=XXXXXXXXX&PWD=XXXXXX&TRXTYPE=A&ACTION=S&TENDER=P&RETURNURL=http://return.com&CANCELURL=http://cancel.com&AMT=0.00&BA_DESC=purchase Time magazine&BILLINGTYPE=MerchantInitiatedBilling&PAYMENTTYPE=any&BA_CUSTOM=magazine subscription

NVP Response:
RESULT=0
RESPMSG=Verified
TOKEN=EC-8DA60888D41196708
CORRELATIONID=f4df94a3345b6 

2.Redirect the customer using the generated token :

https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-8DA60888D41196708

3. Once the buyer accept the agreement use the token to get the billing agreement id

NVP Request:
VENDOR=XXXXXX&PARTNER=XXXXXXX&USER=XXXXXXXX&PWD=XXXXX&TRXTYPE=A&ACTION=X&TENDER=P&TOKEN=EC-8DA60888D41196708

NVP Response:
RESULT=0
PNREF=B1PP7A2F8154
RESPMSG=Approved
TOKEN=EC-8DA60888D41196708
CORRELATIONID=49d6b0037408
BAID=B-6A290557S1180001J 

4. After getting BAID , make a call to create the recurring billing using BAID

NVP Request:
VENDOR=XXXX&PARTNER=XXXX&USER=XXXXXX&PWD=XXXXX&TRXTYPE=R&TENDER=P&ACTION=A&PROFILENAME=RegularSubscription&AMT=4.46&BAID=B-6A290557S1180001J&START=09212014&PAYPERIOD=WEEK&TERM=12&MAXFAILPAYMENTS=1&RETRYNUMDAYS=1&CURRENCY=USD

NVP Response:
RESULT=0
RPREF=R1P57A2F8538
PROFILEID=RT0000000010
RESPMSG=Approved
查看更多
登录 后发表回答