ascandroli
ascandroli

Reputation: 3309

how do I reduce the elapsed time for a billing cycle with PayPal's merchant-sdk-java?

According to the documentation about "Testing Recurring Payments"

When you specify Day, the billing cycle occurs every n minutes in the Sandbox, where n represents the frequency;

So this is what I did:

DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss:'000Z'");
df.setTimeZone(TimeZone.getTimeZone("GMT"));
RecurringPaymentsProfileDetailsType profileDetails = new RecurringPaymentsProfileDetailsType(df.format(new Date()));

BillingPeriodDetailsType trialPeriod = new BillingPeriodDetailsType(BillingPeriodType.DAY, 1, new BasicAmountType(CurrencyCodeType.USD, "40"));
trialPeriod.setTotalBillingCycles(1);

ScheduleDetailsType scheduleDetails = new ScheduleDetailsType();
scheduleDetails.setPaymentPeriod(new BillingPeriodDetailsType(BillingPeriodType.DAY, 1, new BasicAmountType(CurrencyCodeType.USD, "40")));
scheduleDetails.setDescription(agreementDescription);
scheduleDetails.setTrialPeriod(trialPeriod);

CreateRecurringPaymentsProfileRequestDetailsType reqDetails = new CreateRecurringPaymentsProfileRequestDetailsType(profileDetails, scheduleDetails);
reqDetails.setToken(token);

CreateRecurringPaymentsProfileRequestType reqType = new CreateRecurringPaymentsProfileRequestType();
reqType.setCreateRecurringPaymentsProfileRequestDetails(reqDetails);

CreateRecurringPaymentsProfileReq req = new CreateRecurringPaymentsProfileReq();
req.setCreateRecurringPaymentsProfileRequest(reqType);

return service.createRecurringPaymentsProfile(req);

This code works great except for the issue (big issue for me) that it doesn't speed up the process. Without it it's imposible to test IPN for Recurring Payments.

According to this other forum post I might need to enable "Test Mode" for my sandbox business account, but I'm not able to find that option in the new sandbox site.

What am I missing?

Upvotes: 1

Views: 222

Answers (1)

PP_MTS_Chad
PP_MTS_Chad

Reputation: 7319

Unfortunately this was a feature that was rolled out, and removed after a short amount of time. The only way you would be able to test is setting the recurring payments to bill daily. One way around this would be to create a form post with all of the variables you are wanting to send, and just have it post the data to your script and do what it is suppose to. You would just have to bypass the logic of having it validate. However once you have done all of your testing, you can then go back and run a few tests to make sure your script validates the post. Using the form to post the variables to your script, will allow you to test as much as you want with out having to wait for your recurring payments to bill each day.

Upvotes: 1

Related Questions