2017-02-17 82 views
0

我試圖實現具有以下特點的PayPal訂閱系統定期付款:貝寶與試用期

  • 應用服務的第一個月將是完全免費的,之後用戶每月支付金額。

我已經寫了像下面的下面的代碼:

BillingPeriodType periodType = BillingPeriodType.MONTH; 
        switch (subs) 
        { 
         case("Month"): 
          periodType = BillingPeriodType.MONTH; 
          break; 
         case("Year"): 
          periodType = BillingPeriodType.YEAR; 
          break; 
        } 
        BasicAmountType paymentAmount = new BasicAmountType((CurrencyCodeType)EnumUtils.GetValue("USD", typeof(CurrencyCodeType)), subType.Price); 
        BillingPeriodType period = periodType; 
        BillingPeriodDetailsType paymentPeriod = new BillingPeriodDetailsType(period, 1, paymentAmount); 
        ScheduleDetailsType scheduleDetails = new ScheduleDetailsType(); 

        /*Free trial period of 1 month for monthly sub*/ 
        if (periodType == BillingPeriodType.MONTH) 
        { 
         scheduleDetails.TrialPeriod = new BillingPeriodDetailsType(BillingPeriodType.MONTH,1, new BasicAmountType((CurrencyCodeType)EnumUtils.GetValue("USD", typeof(CurrencyCodeType)), "0.01")); 
         scheduleDetails.TrialPeriod.TotalBillingCycles = 1; 
        } 
        else if (periodType == BillingPeriodType.YEAR) 
        { 
         scheduleDetails.TrialPeriod = new BillingPeriodDetailsType(BillingPeriodType.YEAR, 1, new BasicAmountType((CurrencyCodeType)EnumUtils.GetValue("USD", typeof(CurrencyCodeType)), "0.01")); 

        } 

        scheduleDetails.Description = "//Some description" 
        scheduleDetails.PaymentPeriod = paymentPeriod; 
        createRPProfileRequest.CreateRecurringPaymentsProfileRequestDetails.ScheduleDetails = scheduleDetails; 
        CreateRecurringPaymentsProfileReq createRPProfileReq = new CreateRecurringPaymentsProfileReq(); 
        createRPProfileReq.CreateRecurringPaymentsProfileRequest = createRPProfileRequest; 

這引起了我一個巨大的安全隱患......

So let's suppose user subscribes for monthly subscription and get 1 month for free... 

This way, nothing stops the user to cancel the subscription the last day and then to re-subscribe once again and re-use the 1 month trial period for free... 

的用戶對貝寶的信息,我只商店目前ProfileID信息到數據庫....

有沒有任何有效的方式來查看用戶是否使用過我的免費試用期網站?

Also another security concern to me is that user can simply re-register with new account and subscribe once again under completely different ProfileID 

你們會如何解決這個問題?

回答

1

我只希望我不誤解你的問題:

你爲什麼不將用戶的PayPal電子郵件地址鏈接到註冊賬號?在這種情況下,用戶必須使用不同的PayPal賬戶,因此避免這樣的人更容易。

而在用戶註冊時,用戶應該已經提供了他的賬單信息。包括他的PayPal電子郵件地址。

+0

菲利普,好點,但如果用戶添加多個電子郵件地址到他的paypal帳戶,並將新的更改爲主(這是可能的)? =) – User987

+0

哦,我認爲這是不可能的。 PayPal API是否不提供唯一的用戶信息? –

+0

我相信這樣做,那麼我必須檢查他的姓名和預先存在的訂閱配置文件,看他是否有試用期,否?\ – User987