Find charges contained in a Stripe payout - php

Given a Stripe Payout (po_1BRxlK...), how can I determine which charges are contained in this payout? Right now the balance transactions in the API seems like a complete mess.
I've tried searching for all charges between two payouts, but due to the holding period of charges, there might be a shift of a few dates. How would you recommend to match payouts with charges?
I can see that within the Stripe Dashboard, you can see all transactions in a payout, so I assume it's possible to get the same data somehow via the API.
Thanks in advance.

You can use the List all balance history endpoint to do that:
https://stripe.com/docs/api/php#balance_history-payout
If you pass the payout id to the payout parameter you'll get back the list of all balance transactions aggregated in the payout. It only works with automatic payouts though.

You can achieve this by using Report API and API report type: balance_change_from_activity.itemized.1
For more info refer - https://stripe.com/docs/reports/financial-reports/api
Report Schemas - https://stripe.com/docs/reports/financial-reports/report-schemas
For quick reference - you can view the payout reconciliation from dashboard under Reports section.

Related

SquareUp Adding Customer to a group and setting recurring time

I am searching through Squareup API and i can not find a way to add Customer to an existing group and set Recurring timeframe. Can you help me with this?
I saw a guide for charging cards on file but there is no line in that code that sets recurring for example every two months.
By the way i am using PHP. Is anything of this possible?
Currently, you must initiate recurring transactions yourself (with a cron job for example). You cannot specify a customer and a timeframe for Square to bill the customer.

Querying a payout via Stripe API

I am fetching the contributing transactions for a given payout token via the Stripe API (PHP). The query returns no errors, and shows 9 contributing transactions, all correct. However, the amounts shown did not add up to the total paid into the bank. I logged on to Stripe itself, searched for the given payout token, and was shown a listing of the transactions - except now there were 11! I've repeated the process a number of times, but each time I only get the same 9 transactions via the API instead of the complete 11 I get on their site.
Can anyone point me towards a solution? Is there some reason Stripe would truncate an API response for a single payout? I cannot see any mention of doing so in their documentation.
The answer lay in providing a 'limit' parameter to my request. It defaults to 10.

How to get paypal sale transactions

I'm trying to pull in orders from paypal into my database. When I say orders, I mean orders from paypal buttons we have in various places.
I've dove into the REST API, but I don't see any API for searching for / listing transactions. I see a list of payment Resources, but that comes back with count 0.
I also see Sale Transactions in the API but that asks for a single transaction ID.
Is there a way I can periodically get transactions? I know this is possible because we use a tool called Shipstation that grabs new orders from Paypal and brings them into their system.
Thanks!
You can use REST APIs to do what you are wanting to do. You can use
GetPaymentList to do this. This is sample code from the PayPal Github PHP homepage. You will need to install and use the PayPal PHP SDK.

PHP - Best way of taking percentage of transaction

I'm building a website in PHP where users place bids on items. Once bidding has ended, a payment needs to be paid from the winning bidder to the listing owner. But, as the website owner, I also want to take a small percentage - say 5%.
So the process would be the winning bidder pays £100 to the listing owner, and I take 5% as that transaction takes place.
What's the best way of doing this?
I've read about PayPal MassPay, but I'm not sure whether it's what I need or not.
I'm in the UK too, not US - if that effects anything.
You can use Stripe Connect to do this if you're in the UK. You would ask your users to connect their Stripe account to your Connect Application first. You would get some data back, especially a publishable_key and an access_token which you would store on your end.
The you would use those this way:
On the front-end along with Stripe.js or Stripe Checkout you need to use the publishable_key you got from the connected user when going through the Connect flow. You should not use your API key.
Once you get a card token you send it to your server where you will create a charge. There, you should not set your API key but you should pass the access_token of the connected user as a second parameter to the Create Charge API. You can see some example code in the documentation showing how to collect fees.
This would automatically deposit the funds in the connected user's Stripe account minus the Stripe fee and the application_fee you chose. The fee would need to be a specific amount and not a percentage but you can calculate this on your end when creating the charge.
Based on your question, the solution would be as following:
Seller adds a listing on your website.
Bidding starts.
Buyer bids and win. E.g. for $10
Buyer pays using PayPal to your website, where money goes to your account (website owner).
You cut 5% of it, ($0.50) and do a Payout to seller's PayPal account of $9.50.
Optionally/Generally, website owners hold the money till the end of the month, and pay the seller the final amount, (if he is selling more than one thing, or he is a big merchant.)
However, the flow should help you setup a website based on your preferences. Many websites like eBay, Free lancing, apply the similar flow.
As a PayPal Employee, I would recommend using PayPal PHP SDK for developing. All the instructions are provided here and here

Proper way to create dynamic automatic billing method with paypal API?

I know this maybe a duplicate but due to the overwhelming amount of paypal APIs I am having a hard time finding a GOOD answer to my question.
I need to create variable monthly billing per user in PHP. The idea is that a user could sell a number of items with a total sum of sales at the end of the month p. So the billing would be something of the extent MY_PERCENTAGE_FEE * p. The user would then be sent an invoice, and a would be automatically billed via paypal for that amount.
Now, it would be SUPER great if this could be done by creating reoccurring billing and updating the amount at the end of the month. Is that possible? If not what would be the next best way to go?
If you're creating recurring profiles with Payments Pro you can adjust those without any limits. Unfortunately, with Express Checkout you're limited to raising the amount by only 20% every 180 days, so that doesn't normally work out very well. You have a few options of how to get around that.
1) Utilize billing agreements with Express Checkout and Reference Transactions. This would allow you to run an authorization (or an original sale of some sort) for a payer and then from that point on you can use that transaction ID from the original transaction along with a new amount in the DoReferenceTransaction API. Reference Transactions area available with Payments Pro by default, but if you want to use them with Express Checkout you'll need to get that specifically enabled on your account.
2) Use the Preapproval API, which is part of the Adaptive Payments platform. This is similar to reference transactions except that you can create preapproved rules by which you can bill your payers at any time without further approval. This would allow you to process payments for them at any time you need to and pull variable amounts accordingly.
3) Use the Pay API, which is also part of Adaptive Payments, with a split payment (parallel or chained) which would allow you to take your cut in real-time without the need to track balances and submit variable recurring payments. Each time one of your customers is paid for their product/service, you would immediately be paid your share.

Categories