API for retrieving the current balance of my PayPal account? - paypal

Is there an API for retrieving the current balance of my PayPal account? Is there a way I can securely query my PayPal account and retrieve the total balance in my account?
I want to do this to create a "we have x out of y for our monthly quota" type things.

The Transaction Search API has a method to check balances.
To use it, first enable the Transaction Search permission in your REST App settings.
If you requested an API access token in the 9 hours prior to enabling that permission, either terminate that access token or wait up to 9 hours for it to expire from cache.

Related

PayPal API payments wthout sign in, and obtaining an access token

Is it possible to add or link PayPal to an account (get from paypal user access token or something like this ) to allow payments without authorization ( without log in and confirmation like with card if we have card number and cvc ) ?
And second question, I am using paypal sandbox and I cannot refresh the token when trying to execute the query
I get this answer
{
"error": "invalid_refresh_token",
"error_description": "No consent were granted"
}
Its possible they disabled this options on sandbox ?
Regards
Credit card company rules do not permit a cvc to be stored under any circumstances, so you would never "have" this information. It can only be transmitted when a card is first processed and then must be immediately discarded. As for storing card numbers themselves, there are many rules about that (PCI SAQ-D is a place to start, if you need to research it)
To your PayPal question, to be able to bill a PayPal account without the payer signing in (though they will always have to sign in for initial agreement/set up), the receiving PayPal account must have a feature called "reference transactions". The account owner can contact PayPal's general business support (not technical support) to explain the business need and inquire about being approved for enabling this feature. Once enabled, PayPal can guide you on which API to implement -- be it the older billing agreements API or a newer v2 or v3 vault one.
Refresh tokens are used by a Log in with PayPal integration to obtain a new access token when the old one (originally obtained from an authorization_code) is expired. If you are not integrating Log in with PayPal, refresh tokens are not applicable to what you are actually trying to do, and so the request in your screenshot won't be useful to you.
Refresh tokens are not used to obtain a regular REST API access token for authentication, which uses grant_type=client_credentials . If that's what you're actually trying to do, the documentation is here. The public PayPal Postman API collection sample takes care of this step for you, in the collection-level pre-execution script.

Using API or customer permission, Is it possible to get payment from customer account any time?

Using API or customer permission, Is it possible to get payment from customer account any time ?
Actually I have one cloth store,
When my custom make payment first time while purchasing something using paypal wallet/account, i will have set of permission from his paypal account,
Using that i need a functionality when that person buy second time, there account will be auto debited, using their saved paypal token
Is Paypal provide this type of any services or API ?
If yes then tell me some more details i.e. how it works and what is require for that i.e token, API key or any other.
You can refer to the link below for the details to see if this payment method meet your requirement.
https://developer.paypal.com/docs/integration/direct/billing-plans-and-agreements/?mark=billing%20agreement

Paypal: get transaction status and billing status using API call

Paypal provides GetExpressCheckoutDetails to fetch the status of a transaction but it can only be made within 3 hours of the transaction as token gets expired after that.
To fetch status after 3 hrs TransactionSearch API call can be made but it does not provide Billing Agreement status BILLINGAGREEMENTACCEPTEDSTATUS unlike GetExpressCheckoutDetails.
Is there any way in which both statuses can be obtained even after token expiry?
Billing Agreements are created using the EC Token that expires after 3 hours. If you do not use the CreateBillingAgreement API call within those 3 hours, the customer must go through the process again.
So, in short, even if you could get the BillingAgreementAcceptedStatus after the 3 hour mark, it is a moot point.

Can I store a PayPal account to be billed later without an authorization amount?

My service's pricing is based on usage. There's no monthly/weekly subscription, it's one off charges for however much the service is used on that day.
If a user authorizes my service to charge X, but uses the service such that his bill is more than 15% or $75 more than X, I want to be able to charge the user's account appropriately.
PayPal seems to let me create an authorization for a set amount, but it won't process my payment if it's 15% or $75 more than the authorized amount. Is there an API that let's me authorize my service for charging the user's account without an amount?
You can create a billing agreement through reference transactions. Reference Transactions makes a copy of an existing transaction and allows you to charge the customer a different amount. You have to be approved for Reference Transactions so Customer Support will need to put in a request to enable it on your PayPal Account. You can do a reference transaction off of an authorization of $1.00 or a sale. The below is the exact explanation from the PayPal Developer Site of Reference Transactions
A reference transaction is a financial transaction from which
subsequent transactions can be derived. For example, a buyer purchases
an item on your site, and you use the PayPal transaction ID or
reference transaction ID later to initiate another transaction. A
reference transaction must have occurred within the past 730 days
because the ID may not be available after two years.
From the PayPal Developer Site:
Reference Transaction Information
How to Setup a Reference Transaction
How to Initiate a Reference Transaction

billing agreement token lifetime

When I create an agreement for paypal payment, it return the REDIRECT link with a token.
The user must connect to paypal via this link and accept agreement, then I can execute agreement.
I want to know, how long the REDIRECT link (and its assoicated token) is valid ? I ask because I want top precompute agreement and put them in cache, so If user want to subscribe I use a cached REDIRECT link and it's fast. Create agreement call take 2 seconds, it's too long, speed is critical at checkout stage.
I use the REST API + Java.
Express Checkout tokens (which is what REST API returns for the Billing Agreement calls) expire after 3 hours.