I'm using the PayPal Soap-Api.
With the "GetBalance"-Api Operation it's possible to get the current Balance.
But for Accounting reasons, I need to fetch the Balance for every Day in a certain period. e.g.
22.01.2016, Balance: 500,00 €
21.01.2016, Balance: 425,00 €
20.01.2016, Balance: 964,60 €
...
01.01.2015, Balance: 0,00 €
I found no Api-Operation that would match my needs.
So I tried to use the "TransactionSearch"-Api Operation to get the Transactions for this period and calculate the Balance.
Since there is no documentation wether a Transaction is balance-affecting or not, my calculation always failed.
It is possible to set certain filters for the "TransactionSearch"-Api Operation like "BalanceAffecting". But also with this filter set, I get the wrong Transactions to calculate the Balance for every day.
Related
I am building a financial model and adding loan payments, and want the payments to start on a conditional start date.
I can calculate the PMT amount for a loan, but cant seem to get the payments PMT to show up in the specific start date (month) and to end when the balance is 0.
[1]: https://i.stack.imgur.com/4VWzk.png
I have a start date in Column J and calculated the payment, but I get an error message.
I tried the following, but not sure where I am going wrong.
J61 pmt start date either Jan 1 or June 1 2023
S2- start of the month
S4- end of the month
PMT(rate, nper, pv, [fv], [type]) this works
NPER= number of payments
=IFERROR(IF(AND(J61>S3,J61<=S4,1,0)),PMT(G61/H61,I61*H61,F61))
Not sure how to incorporate the ending balance into this formula.
End date with Balance equals= 0
Since your financial model has monthly granularity of calculations, it is not clear how you want to allocate the payments for loans that have intra-month start dates.
Here is a very simple solution that will not allocated pro rata for the days of a month, but allocated the total monthly payments starting with the month of the start date.
=(S$4>=$J61)*(S$4<=EDATE($J61,$H61)-1)*$K61
Which looks like this
So, as you can see in the screenshot, although the start date for the 1st loan is the 31st of January, there will already occur the full PMT amount for the month of January in the timeline.
I'm quite new YQL and i've found the query to retrieve a single quote from a stock
select * from yahoo.finance.quote symbol = "YHOO"
and another query to get this same information but on date range
select * from yahoo.finance.historicaldata symbol = "YHOO" and startDate = "2016-09-01" and endDate = "2016-09-22"
What i could not figure out was: how could we retrieve quotes from a full day of trading?
I'm currently using the Yahoo finance app and notice they provide a good graphic about the price variation, so i presume there is a way to achieve it.
I also tried to read yql tables repository but on both table that i am using there is no (at least explicit) clue of how to pass hour range.
You can retrieve the complete quotes of a day by querying the Yahoo Finance API endpoint directly (not via YQL) and receiving a list in JSON format.
The end point is http://chartapi.finance.yahoo.com/instrument/1.0/$symbol/chartdata;type=$type;range=$range/json/, where:
$symbol is the stock ticker symbol, e.g. AAPL for Apple or BAS.DE for BASF traded at Xetra
$type is the type of the query, you can query for quote, sma, close, volume
$range is the desired latest days with 1d, 5d, 10d, 15d
An example query would be
http://chartapi.finance.yahoo.com/instrument/1.0/aapl/chartdata;type=quote;range=1d/json/
which gives you all quotes from AAPL from the last day.
As far as I know, you can only query for the quotes up to the last 15 days. I have not yet found a way to query for some other day further in the past.
Just my self-centric hint: check out my PHP package YahooFinanceQuery on Github, which uses an implementation of the above query and handles the returning JSON to filter the results.
As an update/extension to my previous answer I found a new API endpoint to download daily quotes.
Yahoo changed their API endpoints in early 2017.
The new endpoint is:
https://query1.finance.yahoo.com/v8/finance/chart/{$symbol}?range={$range}&interval={$interval}, where:
$symbol is the stock ticker symbol, e.g. AAPL for Apple
$range is the desired range of the query, allowed parameters are [1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max]
$interval is the desired interval of the quote, e.g. every 5 minutes, allowed parameters are [1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo]
An example would be: https://query1.finance.yahoo.com/v8/finance/chart/AAPL?range=10d&interval=1m where you receive OHLCV quotes for the AAPL stock from the last 10 trading days with a 1 minute interval. All in a nicely JSON format.
Not all $range parameters will return results with the specified $interval, but will return the nearest possible combination. For example, the "max" range will return all quotes with a "1mo" interval.
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.
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.
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.