need explanation for PayPal recurring options: BILLINGPERIOD, BILLINGFREQUENCY, TOTALBILLINGCYCLES - paypal

https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECRecurringPayments/
I understand that setting BILLINGPERIOD to MONTH and BILLINGFREQUENCY to 1 will charge the user once a month.
But according to the above link, TOTALBILLINGCYCLES is optional and is set to 0 by default. So if I don't include that option, will the user be charged once a month forever or stopped after charging for the first year (12 times)?
Also, I want to charge the user for the first year only. What should i do? Should i set TOTALBILLINGCYCLES to 1 to achieve it?
Please advise.
Thanks

Please find TOTALBILLINGCYCLES in the link below:
https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/CreateRecurringPaymentsProfile_API_Operation_NVP/
For the regular payment period, if no value is specified or the value is 0, the regular payment period continues until the profile is canceled or deactivated.
If you want to charge the user for the first year only, TOTALBILLINGCYCLES depends on your billing period.
If you set BILLINGPERIOD=Month and BILLINGFREQUENCY=1, you should set TOTALBILLINGCYCLES=12 to charge one year.
If you set BILLINGPERIOD=Year and BILLINGFREQUENCY=1, you should set TOTALBILLINGCYCLES=1 to charge one year.

Related

(Google Sheets) How do you get cells to alter based on a certain date?

I'm looking to create a spreadsheet to get a grasp of what my personal finances are saying. Part of this obviously involves putting in income from my job. While I know my shifts in advance so I know how much I will be earning on any given day, I won't actually get the money until the end of the month.
I've created a cell called 'bank balance' based on my current savings, but obviously I don't want to have to physically update this every time I get paid so I'd like to just be able to give Sheets a date where it can update that cell itself based on my payday.
For example:
I start off with £100 in my bank account on January 15th. I know I'm going to get paid £400 on January 28th (last working day of the month). I don't want to input that on Jan 15th as that wouldn't be an accurate reflection of my finances. So I input something that tells sheets to add that £400 on to the bank balance cell on Jan 28th for me.
[The example sheet on January 15th]
[The example sheet on payday January 28th after automatically adding on the £400 to the bank balance]
I've currently got a separate cell for 'work income' that I want to apply this function to (I.E. so that I can tell the sheet to add the total 'work income' to 'bank balance' on payday) but I'm not sure where to go from here.
I've got similar issues with subscriptions leaving my account on various days of the month but the income is my higher priority.
Any help with this would be greatly appreciated

How do I refresh the database annually?

I am storing the user information in my database along with other attributes such as his annual leave/vacation balance.
The user annual leave would be 14 days every year but I want to refresh it every year and add another 14 to it. If the user had 3 days of annual leave left at year's end, then he would start the new year with a 17 day balance.
Just use the percolate:synced-cron package to create an annual job to update such balances.
You might also need a lastUpdatedDate to make sure you don't accidentally add to the balance twice. You have to anticipate any errors that would leave your data partially-updated.

PayMill subscription interval regularity

Simple questions, but I can't seem to find the answers in PayMill's API documentation or FAQ:
If a payment subscription is classed as monthly, does it poll for the funds every 30 days or on the anniversary of the month, i.e. set up on 15.4.2014, next payment 15.5.2014?
If it polls on the same date every month, what happens if the subscription was set up on the 31st of the month, i.e. on a date not present in February, April etc?
Thanks.
On the same date. If the interval is 1 MONTH and the first payment occurs on 15.4.2014 the next one will be on 15.5.2014. Note that you can also specify a weekday, in that case it will be the next weekday (e.g. Monday), either the 15.05.2014 (if it's a Monday) or the first Monday after 15.05.2014
It will probably be on the next day (1 March instead of the "missing 31 February". It will definitely not be skipped. If the exact behavior is crucial for your business, please contact the PAYMILL support to seek a definite answer.

PayPal billing agreements REST API - how to start immediately

How can I start charging a user the user immediately for a PayPal billing agreement?
Here's what I've got so far.
Create a Billing Plan (POST .../payments/billing-plans/)
Make it active (PATCH .../payments/billing-plans/)
Create a Billing Aggreement (POST .../payments/billing-agreements/)
Send user to approval_url, user approves, redirected to return url
Execute agreement (POST .../payments/billing-agreements//agreement-execute)
This all seems to work, but I want to charge the user right now and every month in the future. If I set start_date to now in step 3 I get an error, it must be in the future. If I set it in the future the user is not charged.
Do I need to 'Set outstanding agreement amounts' then 'Bill outstanding agreement amounts' for the initial payment?
Also, what about monthly payments, do they require some action or do they just happen as specified in the Billing Plan?
Update
I'm testing this around 2014-09-16T20:06:30+0000
If I send start_date as the current UTC time it get an error at step 2 telling me it must be in the future.
If I send the current date +30 secs or +2 hours I get through to step 5 which returns a 400 response: UNKNOWN_ERROR "An unknown error has occurred"
If I send the current date +4 hours it all works. The current UTC time is 8pm so adding 4 hours means the start_date is tomorrow.
Does this mean I can't charge the user today? Does the start_date have to be in next day or even the next business day?
I've talked to a PayPal rep and found that start_date must be tomorrow or later. They are going to add this to the docs.
If you want to start monthly billing immediately you might be able to do it by setting the start date to be in one months time and charging a setup fee to cover the first month. I haven't tested this as it's not what I want.
First payment for agreements will be billed right on specified start_date. The subsequent amounts are also taken automatically by PP. You need to work with the BillOutstandingAmount calls only if PP failed to pick the payment on the renewal date.
The problem I faced when developing with their RestAPI was specifying a wrong timezone. Maybe this is the same for you. Make sure the proper timezone is specified in your start_date (with all dates given to PP in fact)
Dates should be in this format: yyyy-MM-ddTHH:mm:ssZ
ex. start_date = 2014-09-16T09:20:00-0400
IF you want to make sure Paypal accepts the date as being valid, just add a few seconds to it.
Let's say you are in Java, you can do something like:
private String getPaypalDate()
{
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
// Add 30 seconds to make sure Paypal accept the agreement date
Date rightNow = new Date(new Date().getTime() + 30000);
return df.format(rightNow);
}
I used this date format working.
$time = time();
$startDate = date('Y-m-d\\TH:i:s\\Z', $time);
I can't replicate, actually. I stumbled on this thread when getting the error due to setting it to moment.now(). But setting it to even 5 seconds in the future works a-ok. I'm using JavaScript, "start_date": moment().add({seconds:5}).format() and that checks out fine. Moment.js will set TZ to UTC when formatting as such, so it's gotta be a timezone thing on your end?
It looks like the payments just process based on the date being before or after 07:00 UTC of the current date.
For example. The current date time is 2017-05-04T04:50:00.00Z I set my start date to be the current UTC date time plus 30 seconds. Because the agreement date is set to a value greater then the current date time the API doesn't throw an error, but it DOESN'T set your time to be what you specified. Instead it sets it to 2017-05-04T07:00:00Z.
Now, if you have the same date time of 2017-05-04T04:50:00.00Z and instead of adding 30 seconds you add 24hrs you'd think that your time would then be set to be 2017-05-05T04:50:00.00Z. But no, the time will be set to 2017-05-05T07:00:00Z.
So it seems like these just process everyday at 07:00 UTC and you can't specify anything but the date.

account's balance at a point of time in AggCat

Is there anyway to obtain an account's info including account's balance at a point of time? Basically, I need to get the account's balance at the beginning of month and end of month for accounting purposes. However, a cron job to update account's info at the beginning/end of month may fail for various reasons, in which case there is no way to retrieve account's balance at beginning/end of month anymore!
We do not have a mechanism to capture the value at a specific time as you are asking but provide a balance each time you capture the transactions. If you capture a day later you can always perform a reverse running balance using the current balance - the transactions that occured between the data you wish to display.
Example:
August 1st:
$5.00 Transaction to McDonalds
$3.00 Transaction to Ralphs
Balance on August 2nd:
$35.00
Calculate Balance for the 1st.
$35 + 5 + 3= $43.00 balance at start of month.
You add the debits and subtract the credits and you can obtain the value you are seeking.