我在我的網站創建了每月訂閱的定期付款。用戶將每月付款。但是我發現買方支付了兩次訂閱費用,一次用於啓動,一次用於重複使用。 我看了https://developer.paypal.com/docs/classic/api/merchant/DoExpressCheckoutPayment_API_Operation_NVP/,我們可以在這個和SetExpressCheckout中設置PAYMENTREQUEST_n_AMT = 0來忽略啓動付款。但是,當我將它設置爲0時,我得到的錯誤是所有數都爲零,因此我可以完成結帳。 如何創建無限次的無限次循環。我嘗試跳過DoExpressCheckoutPayment方法,但通過這種方式,我無法獲得交易ID通過paypal快速結賬定期訂閱,買方支付兩次
回答
當您創建定期付款時,您可以選擇向用戶收費兩次 - 其中一個與INITAMT參數相關,並且會立即從用戶收取費用帳戶。二是與BILLINGPERIOD,BILLINGFREQUENCY,TOTALBILLINGCYCLES和REGULARTOTALBILLINGCYCLES貝寶參數相關,這與定期付款AFTER當前時間段有關。關鍵是要設定的時間再現週期後付款,並設置INITAMT拿到首付款立即
對於(PHP)例如:
$padata['BILLINGPERIOD'] = 'Month';
$padata['BILLINGFREQUENCY'] = '1';
$padata['TOTALBILLINGCYCLES'] = '12';
$padata['REGULARTOTALBILLINGCYCLES'] = '1';
$padata['INITAMT'] = 'MONTHLY PRICE';
在定期付款沒有事務ID,但現有的訂閱你的情況ID此鍵將簡檔+的correlationID
對不起,我想立即收取第一個循環。但我不想收費發起。如果我設置INITAMT,這意味着買方收取2次? –
在這種情況下,必須像我的例子 – Pavel
設置貝寶參數我試過,看到買家收取2倍這樣的http://pasteboard.co/1c2htGOT.png 但我希望它只收取一次。對不起,如果我誤解你的評論。 –
以下是我的應用程序代碼,首先我打電話setExpressCheckout()
比getExpressCheckoutDetails()
比在使用這塊令牌recieving支付和生成輪廓
if(request.getParameter("token")!= null && request.getParameter("PayerID") != null){
if(token.contentEquals(request.getParameter("token"))/* && payerID.contentEquals(request.getParameter("PayerID"))*/){
this.payerID = request.getParameter("PayerID");
if(doExpressCheckout()){
if(createRecurringProfile()){
//some notification showing successful order
log.debug("Trasaction status : Successfull");
license.setProfileID(profileID);
license.setActive(true);
license.setLicenseType(LicenseBean.PAYMENT_RECURRING);
ApplicationInstance.getCurrent().fireEvent("SaveLicense", description, license,false);
ApplicationInstance.getCurrent().fireEvent("DisplayLicenseDetails", "Success", license,false);
}
下面的代碼是四種方法
public String setExpressCheckout() {
NVPEncoder encoder = new NVPEncoder();
NVPDecoder decoder = new NVPDecoder();
try
{
encoder.add("VERSION", "86.0");
encoder.add("METHOD","SetExpressCheckout");
encoder.add("L_BILLINGTYPE0","RecurringPayments");
encoder.add("L_BILLINGAGREEMENTDESCRIPTION0","UserPack");
// Add request-specific fields to the request string.
encoder.add("RETURNURL",returnURL);
encoder.add("CANCELURL",cancelURL);
encoder.add("AMT",cost);
encoder.add("PAYMENTACTION",paymentAction.getValue());
encoder.add("CURRENCYCODE",currencyCode.getValue());
// Execute the API operation and obtain the response.
String NVPRequest= encoder.encode();
String NVPResponse =caller.call(NVPRequest);
decoder.decode(NVPResponse);
}
catch(PayPalException pe){
log.error("Paypal Exception:", pe.getCause());
}
catch (Exception ex)
{
log.error(ex);
}
return decoder.get("TOKEN");
}
public boolean getExpressCheckoutDetails(String token)
{
NVPEncoder encoder = new NVPEncoder();
NVPDecoder decoder = new NVPDecoder();
try
{
encoder.add("VERSION", "86.0");
encoder.add("METHOD", "GetExpressCheckoutDetails");
// Add request-specific fields to the request string.
// Pass the token value returned in SetExpressCheckout.
encoder.add("TOKEN", token);
// Execute the API operation and obtain the response.
String NVPRequest = encoder.encode();
String NVPResponse = caller.call(NVPRequest);
decoder.decode(NVPResponse);
// payerID = decoder.get("PAYERID");
payerName = decoder.get("PAYERNAME");
}catch (Exception ex)
{
log.error(ex);
}
if(decoder.get("ACK").toLowerCase().contains("success")){
this.token = token;
return true;
}
else{
return false;
}
}
public boolean createRecurringProfile()
{
NVPEncoder encoder = new NVPEncoder();
NVPDecoder decoder = new NVPDecoder();
try
{
encoder.add("VERSION", "86.0");
encoder.add("METHOD","CreateRecurringPaymentsProfile");
encoder.add("DESC","UserPack");// #Profile description - same as billing agreement description
encoder.add("BILLINGPERIOD","Month");// #Period of time between billings
encoder.add("BILLINGFREQUENCY","1");// #Frequency of charges
// encoder.add("INITAMT","25.29");
// encoder.add("FAILEDINITAMTACTION","ContinueOnFailure");
// Add request-specific fields to the request string.
// Pass the token value by actual value returned in the SetExpressCheckout.
encoder.add("TOKEN",token);
encoder.add("PAYERID",payerID);
Date localTime = new Date();
//creating DateFormat for converting time from local timezone to GMT(as specified in paypal)
DateFormat converter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
encoder.add("PROFILESTARTDATE",converter.format(localTime));//SimpleDateFormat.getTimeInstance().format(new Date())
encoder.add("AMT",cost);
encoder.add("CURRENCYCODE","USD");// #The currency, e.g. US dollars
encoder.add("COUNTRYCODE","US");// #The country code, e.g. US
encoder.add("MAXFAILEDPAYMENTS","3");
// encoder.add("PAYMENTACTION",paymentAction.getValue());
encoder.add("CURRENCYCODE",currencyCode.getValue());
// Execute the API operation and obtain the response.
String NVPRequest = encoder.encode();
String NVPResponse =caller.call(NVPRequest);
decoder.decode(NVPResponse);
profileID = decoder.get("PROFILEID");
profileStatus = decoder.get("PROFILESTATUS");
//transactionID = decoder.get("TRANSACTIONID");
paymentDate = decoder.get("PAYMENTDATE");
log.debug("Paypal acknowledgement: "+decoder.get("ACK"));
//System.out.println("Paypal acknowledgement: "+decoder.get("ACK"));
}
catch(PayPalException pe){
log.error("Paypal Exception:", pe.getCause());
}
catch(Exception ex)
{
log.error("Error :",ex.getCause());
}
if(decoder.get("ACK").toLowerCase().contains("success")){
return true;
}
else{
//System.out.println("Paypal error: "+decoder.get("L_SHORTMESSAGE0"));
log.error("Paypal error: "+decoder.get("L_SHORTMESSAGE0"));
return false;
}
}
public boolean doExpressCheckout()
{
NVPEncoder encoder = new NVPEncoder();
NVPDecoder decoder = new NVPDecoder();
try
{
encoder.add("VERSION", "51.0");
encoder.add("METHOD","DoExpressCheckoutPayment");
// Add request-specific fields to the request string.
// Pass the token value by actual value returned in the SetExpressCheckout.
encoder.add("TOKEN",token);
encoder.add("PAYERID",payerID);
encoder.add("AMT",cost);
encoder.add("PAYMENTACTION",paymentAction.getValue());
encoder.add("CURRENCYCODE",currencyCode.getValue());
// Execute the API operation and obtain the response.
String NVPRequest = encoder.encode();
String NVPResponse =caller.call(NVPRequest);
decoder.decode(NVPResponse);
//transactionID = decoder.get("TRANSACTIONID");
paymentDate = decoder.get("PAYMENTDATE");
log.debug("Paypal acknowledgement: "+decoder.get("ACK"));
//System.out.println("Paypal acknowledgement: "+decoder.get("ACK"));
}
catch(PayPalException pe){
log.error("Paypal Exception:", pe.getCause());
}
catch(Exception ex)
{
log.error("Error :",ex.getCause());
}
if(decoder.get("ACK").toLowerCase().contains("success")){
return true;
}
else{
//System.out.println("Paypal error: "+decoder.get("L_SHORTMESSAGE0"));
log.error("Paypal error: "+decoder.get("L_SHORTMESSAGE0"));
return false;
}
}
- 1. PayPal快速結賬引用支付
- 2. 使用Paypal支付高級(和NVP API)的PayPal快速結賬的訂單項
- 3. PayPal:快速結賬付款無帳戶
- 4. 通過PayPal快速結賬購物車
- 5. Paypal訂閱/定期付款
- 6. PayPal定期付款/訂閱
- 7. Paypal使用快速結賬的定期付款
- 8. PayPal快速結賬
- 9. 在PayPal並行快速結賬訂單
- 10. 集成PayPal鏈接/並行支付與快速結賬
- 11. PayPal Sandbox |快速結賬允許信用卡支付
- 12. 捕獲支付;快速結賬
- 13. PayPal快速結帳訂閱使用信用卡付款
- 14. PayPal快速結賬按鈕
- 15. 移動快速結賬Paypal
- 16. Grails和PayPal(快速結賬)
- 17. Paypal訂閱/定期付款通過API更改資金來源
- 18. 貝寶快速結帳支付作爲嘉賓訂閱
- 19. Paypal訂閱在首次付款後過期
- 20. PayPal訂閱/定期付款,開頭爲一次性費用
- 21. 貝寶:通過快速結賬的定期付款,無需用戶必須有一個PayPal帳戶
- 22. PayPal快速結賬:檢查付款可以點擊鏈接
- 23. 運費沒有顯示出來,通過PayPal快速結賬
- 24. PayPal快速結賬試用期 - 付款延遲最多24小時?
- 25. Woocommerce通過PayPal Express付款強制結賬,而不是PayPal Standard
- 26. Paypal快速結賬給出錯誤
- 27. Paypal快速結賬與Rails 3
- 28. PayPal快速結賬整合到網站
- 29. codeigniter 2.x.x和paypal快速結賬
- 30. 使用SOAP實現快速結賬(PayPal)
你設置任何初始確認金額,我也實施了定期付款,我還沒有遇到這樣的問題 – SSH
不,我不要在我的CreateRecurringPaymentProfile方法中設置INITAMT。 這是參數I在SetExpressCheckout –
通過下面是在DoExpressCheckoutPayment參數 $字段=陣列(\t \t \t \t \t \t 'TOKEN'=> $ checkoutDetails [ 'TOKEN'], \t \t 'PAYMENTACTION'=>「塞爾」, \t \t 'PAYERID'=> $ checkoutDetails [ 'PAYERID'], \t \t 'PAYMENTREQUEST_0_AMT'=> '5.0', \t \t 'PAYMENTREQUEST_0_CURRENCYCODE'=> 'NOK' \t \t); 並建立個人資料 $字段=陣列( \t 'TOKEN'=>進行urlencode($ checkoutDetails [ 'TOKEN']), \t 'PAYERID'=>進行urlencode($ checkoutDetails [ 'PAYERID']), \t「PROFILESTARTDATE '=>時間(), \t 'DESC'=> '測試', \t 'BILLINGPERIOD'=> '月', \t 'BILLINGFREQUENCY'=> '1', \t 'TOTALBILLINGCYCLES'=> '60' , \t'AMT'=>'5。0', \t'CURRENCYCODE'=>'NOK' \t \t); –