我正在尝试使用经典API设置定期付款。在沙盒中我试图理解,鉴于我在这里的设置,为什么我得到一个返回结果显示下一个付款到期日是在1个月,当我可以告诉我为3配置这个月试用期。这是我正在使用的代码:
=============================================== =========
Private Function CreateRecurringPaymentsProfileRequestType(token As String,
subscriptionName As String,
monthlyAmount As String,
startDate As DateTime) As CreateRecurringPaymentsProfileRequestType
Dim reqType As New CreateRecurringPaymentsProfileRequestType()
Dim reqDetails As New CreateRecurringPaymentsProfileRequestDetailsType()
reqType.CreateRecurringPaymentsProfileRequestDetails = reqDetails
reqDetails.Token = token
Dim profDetails As New RecurringPaymentsProfileDetailsType()
reqDetails.RecurringPaymentsProfileDetails = profDetails
profDetails.BillingStartDate = startDate.ToString("s")
Dim schedDetails As New ScheduleDetailsType()
reqDetails.ScheduleDetails = schedDetails
schedDetails.Description = subscriptionName
schedDetails.AutoBillOutstandingAmount = AutoBillType.NOAUTOBILL
Dim activationDetails As New ActivationDetailsType()
schedDetails.ActivationDetails = activationDetails
Dim payPeriod As New BillingPeriodDetailsType()
schedDetails.PaymentPeriod = payPeriod
schedDetails.AutoBillOutstandingAmount = AutoBillType.ADDTONEXTBILLING
schedDetails.MaxFailedPayments = 3
'== schedDetails.TrialPeriod -> trial period setup
Dim TrialPeriodPayment As New BasicAmountType(CurrencyCodeType.USD, "0.00")
Dim trialPeriod As New BillingPeriodDetailsType()
trialPeriod.Amount = TrialPeriodPayment
trialPeriod.BillingPeriod = BillingPeriodType.MONTH
trialPeriod.BillingFrequency = 1
trialPeriod.TotalBillingCycles = 3
schedDetails.TrialPeriod = trialPeriod
Dim basicPayment As New BasicAmountType(CurrencyCodeType.USD, monthlyAmount)
payPeriod.Amount = basicPayment
payPeriod.BillingPeriod = BillingPeriodType.MONTH
payPeriod.BillingFrequency = 1
Return reqType
End Function
在返回页面上,我这样做是为了从PayPal收集信息以向最终用户显示。由于我将试用期设置为3个月,因此我希望下一个结算日期显示为今天的日期+ 3个月。相反,它显示我今天的日期+ 1个月(注意:为了简洁起见,我将从此例程中删除不相关的代码):
Public Sub GetDetailsAndCreateRecurringPayment(token As String)
'== CHECK ON PAYMENT INFO RETURNED BY USER FROM PAYPAL REDIRECT
Dim detailsResponse As GetExpressCheckoutDetailsResponseType
Dim details As GetExpressCheckoutDetailsResponseDetailsType
Dim recurResponse As CreateRecurringPaymentsProfileResponseType
Dim recurDetails As CreateRecurringPaymentsProfileResponseDetailsType
Dim profResponse As GetRecurringPaymentsProfileDetailsResponseType
Dim profDetails As GetRecurringPaymentsProfileDetailsResponseDetailsType
...
Dim NextBillingDate() As String
...
'== GET DATA FROM PAYPAL
detailsResponse = payPalUtil.GetExpressCheckoutDetails(token)
details = detailsResponse.GetExpressCheckoutDetailsResponseDetails()
recurResponse = payPalUtil.CreateRecurringPaymentsProfile(token, MySession.ElthosPaymentType, MySession.ElthosPaymentAmount, DateTime.Now)
recurDetails = recurResponse.CreateRecurringPaymentsProfileResponseDetails
profResponse = payPalUtil.GetRecurringPaymentsProfile(recurDetails.ProfileID)
profDetails = profResponse.GetRecurringPaymentsProfileDetailsResponseDetails
'== CHECK FOR ERRORS - IF ANY THEN PRINT TO SCREEN AND EXIT SUB
Dim errorsText As String = ""
If (detailsResponse.Errors.Count > 0) Then
For Each errorObj As ErrorType In detailsResponse.Errors
errorsText = errorsText & errorObj.ShortMessage
Next
Lab_detailErrors.Text = errorsText & ". "
Exit Sub
End If
...
NextBillingDate = profDetails.RecurringPaymentsSummary.NextBillingDate.ToString.Split("T")
...
End Sub
我做错了什么,或者我不明白Sandbox应该如何处理下一个结算日期?任何帮助都非常感谢!谢谢!
关于如何在Sandbox中有效测试这一点的任何建议也将受到高度赞赏。再次感谢!