Stripe connect subscription split fees - php

Hi i'm using the stripe PHP API to build a platform for a client, the platform is selling monthly subscription to author content on a monthly basis I have a deal with my client to share 50% of the fees we taking on each subscriptions.
I used this snippet to make the subscription:
$stripe->subscriptions->create([
'customer' => '{{CUSTOMER}}',
'items' => [['price' => '{{PRICE}}']],
'expand' => ['latest_invoice.payment_intent'],
'application_fee_percent' => 10,
'transfer_data' => ['destination' => '{{CONNECTED_STRIPE_ACCOUNT_ID}}'],
]);
I was wondering if how i can transfer my half of the 10% automatactly and monthly to an other connected acconunt (mine)... Can someone help me with that?

Given the subscription is on the platform, you can transfer funds to multiple connected accounts after the charge.
Alternatively, you can keep the same code you shared here and then transfer the 5% from the application fee to the other connected account separately. You’d listen to invoice.paid Event and when creating the transfer, pass the source_transaction parameter which transfers funds from a charge. These funds will not become available until the original charge is settled.

Related

Stripe Payment gateway

I'm creating service like Airbnb using Laravel. So I'm using stripe payment gateway for my project. So I want to create escrow system using stripe. Let's say someone book properties of seller ABC for 3 days. On booking amount is debit from buyer's account and credit to the admin Account. Now on journey completion seller ABC get his money and Admin get his commission from booking. So we have to transfer money to seller account only when journey is complete.
So I'm using following method to achieve this following methods.
Payment Authorization
\Stripe\Stripe::setApiKey('sk_test_****');
\Stripe\PaymentIntent::create([
'amount' => 1099,
'currency' => 'inr',
'payment_method_types' => ['card'],
'capture_method' => 'manual',
]);
Payment Capture
\Stripe\Stripe::setApiKey('sk_test_*****');
$intent = \Stripe\PaymentIntent::retrieve('pi_****');
$intent->capture(['amount_to_capture' => 750]);
Transfer Payment
// Create a Transfer to a connected account (later):
$transfer = \Stripe\Transfer::create([
'amount' => 7000,
'currency' => 'inr',
'destination' => '{{CONNECTED_STRIPE_ACCOUNT_ID}}',
'transfer_group' => '{ORDER10}',
]);
But it's not working properly because I'm getting following error.
Funds can't be sent to accounts located in IN because it's restricted outside of your platform's region;
Can someone please guide me to achieve my requirements.
It seems Stripe only accepts INR payouts within India.
Is your stripe account within India?
Stripe currently does not support the ability to receive INR payouts from Stripe accounts registered outside of India.
Stripe support documentation

Payment Intent issues Stripe Connect

I am developing a small online marketplace in WordPress for a client and I am using Stripe Connect. What I am trying to accomplish is:
User A is posting a project, User B bids for this project, gets accepted and delivers the work.
User A now has to pay the agreed amount for the deliverable
User A gets his card charges, Platform account gets the application fee, Stripe gets the Stripe fee, User B gets paid with the remaining amount
I have created the following function with payment intent, destination charge and application amount fee as described here: https://stripe.com/docs/connect/collect-then-transfer-guide
function destination_charge(){
// Set your secret key. Remember to switch to your live secret key in production!
\Stripe\Stripe::setApiKey('sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
$payment_intent = \Stripe\PaymentIntent::create([
'payment_method_types' => ['card'],
'amount' => 1000,
'currency' => 'usd',
'application_fee_amount' => 123,
'transfer_data' => [
'destination' => 'acct_UserB',
],
]);
}
So if I understand the docs and the concept correctly, when User A triggers the above function, User A gets charged $10 on his card, application takes $1.23 fee and User B gets the remaining amount. Stripe deducts its service fee from the application. Although I am not charging anything from a form, since User A is a verified connected account with card details already in Stripe Connect.
Unfortunately this is not the case though and even if I try separating charges from transfers, as described here: https://stripe.com/docs/connect/charges-transfers, it's not working either.
Stripe Connect is setup for US businesses, USD currency. I am using Express Accounts on a test environment.
Side note: I already tried using top-ups in order to add test funds and create balance, but the "add to balance" button is not available for some reason. https://stripe.com/docs/connect/top-ups
What am I missing here? Is destination charges the right choice for what I am trying to accomplish?
Any suggestion would be helpful.
Thanks.
You can try to use the stripe-account header. By using this, you are simply making the request on-behalf of the connected account. The payment will automatically be credited to the connected account.
$payment_intent = \Stripe\PaymentIntent::create([
'payment_method_types' => ['card'],
'amount' => 1000,
'currency' => 'usd',
'application_fee_amount' => 123,
], ['stripe-account' => 'acct_UserB']);
}
\Stripe\PaymentIntent::confirm(
$payment_intent->id,
['payment_method' => 'pm_card_visa']
);

Paypal merchant paying facilitator

I have set up a sandbox test case whereby I allow merchants to link and grant express checkout permission to my facilitator account, coupled with a second page where end users can purchase items from the merchants accounts. The problem I am having is that on completion of an express checkout, the facilitator is receiving all the money instead of the merchant. The merchant receives the credit card payment but immediately pays the facilitator the full amount.
Using this guide: https://devtools-paypal.com/guide/expresscheckout/php?interactive=OFF&env=sandbox
I have then created an express checkout on behalf of the merchant account.
Auth details:
'mode' => 'sandbox',
'acct1.UserName' => 'dev-facilitator...',
'acct1.Password' => 'dev-facilitator_pw...',
'acct1.Signature' => 'dev-facilitator...',
'acct1.AppId' => 'APP-80W284485P519543T',
'acct1.accessToken' => $merchant_token,
'acct1.tokenSecret' => $merchant_secret
My code looks very similar to the example, with the assumption that the PaymentDetailsType passed through to DoExpressCheckoutPayment is that same as received from GetExpressCheckoutDetails
Everything appears to be working correctly except that when the users completes the payment the merchants paypal ends up looking like:
Purchase From, dev-facilitator, Completed, Details, -$250 NZD
Transfer From, Credit Card , Completed, Details, $250 NZD
With the final result being:
Dev-facilitator balance: $250 NZD
Dev-merchant balance: $0 NZD
I'm not sure where in the express checkout setup I should be specifying the kind of invoice the merchant should file against the facilitator in relation to the express checkout.
I can provide further code snippets if required.
It appears the core of my problem is the fact that accessToken and tokenSecret are ignored if acct1.Subject is not also supplied (The email associated with the accessToken).
The second thing that caused confusion is that I was not paying attention to what account my buyer action was being performed against... Logging into my merchant account changed the cookies that I was using in the other tab for doing the express checkout. Thus the merchant account ended up being the buyer, and the facilitator the merchant... The Purchase From, Transfer From, was just the way credit card transactions are shown: IE first the credit card gets converted into paypal money and then that is used in the paypal purchase transaction.
Thus,
'mode' => 'sandbox',
'acct1.UserName' => 'dev-facilitator...',
'acct1.Password' => 'dev-facilitator_pw...',
'acct1.Signature' => 'dev-facilitator...',
'acct1.AppId' => 'APP-80W284485P519543T',
'acct1.Subject' => $merchant_email,
'acct1.accessToken' => $merchant_token,
'acct1.tokenSecret' => $merchant_secret
Is what I should have supplied.

stripe fund transfer not working properly

I am creating e-Com website. In which I am using stripe payment. The goal is we charge the user and then send amount to admin account and 80% of total charge transfer into vendor account.
The user payment working fine. In stripe admin account i can see the amount is increases per transaction. And vendor amount transfer is also working fine. In stripe admin account ,The Transfer link on left side showing all transfer history.
But when i login to vendor stripe account , I am getting $0 amount. Because transfer was not done.
Here is my transfer code:
$transfer = \Stripe\Transfer::create(array(
"currency" => "usd",
"recipient" => "rp_16lDd5AjH6fE1nozBz8hoQMY",
'amount' => $amount,
//'destination' => "ba_16lDe5AjH6fE1noz5V8oSTzU",
'destination' => "ba_16nn5nAjH6fE1nozX6xpp6JA",
"failure_message" => null,
"failure_code" => null,
)
);
It gives me success msg. After 2-7 days transfer amount not transferred into vendor stripe account. Please help me out.

PayPal Parellel payments and refunds

I have a question regarding Parallel payments and refunds. We are developing an application that sets up a Parallel payment, with ourselves as the My Store receiver and the provider of the service as the seller receiver. We provide a mechanism for the secondary receiver to refund the complete payment.
(source: ohozaa.com)
What we want to know is what happens when the seller receiver has no funds in their paypal account? From testing this in the sandbox and from what we've read, it seems that the seller receiver component of the refund becomes pending (we assume, as funds are pulled down from an associated bank account). Three things:
Has the My Store receiver paid the refund in full and is now waiting to get the payment from the seller receiver. Implying that, at this point in time, the My Store receiver is out of pocket?
What happens if funds cannot be pulled down from the seller receivers associated bank account?
What happens if we attempt a refund from an unverified user with no funds in their paypal account? Once again, does the My Store receiver pay the refund in full and hope to collect the seller receivers portion when they do have funds?
Unless I am misunderstanding the situation there are three possible questions/outcomes.
You submit a payment to pay mystore#test.com 10 dollars and seller1#test.com 90 dollars for a total of 100 dollars:
https://svcs.sandbox.paypal.com/AdaptivePayments/Pay
'currencyCode' => 'USD',
'actionType' => 'PAY',
'receiverList.receiver(0).email' => 'mystore#test.com',
'receiverList.receiver(0).amount' => '10',
'receiverList.receiver(1).email' => 'seller1#test.com',
'receiverList.receiver(1).amount' => '90',
'requestEnvelope.errorLanguage' => 'en-US',
buyer#test.com wants a refund:
1) If you have API permission to submit refunds for seller1#test.com you can refund his part of the transaction as well as yours. You do this by passing the receiverList variables:
https://svcs.sandbox.paypal.com/AdaptivePayments/Refund
'payKey' => $thepaykey,
'receiverList.receiver(0).email' => 'mystore#test.com',
'receiverList.receiver(0).amount' => '10',
'receiverList.receiver(1).email' => 'seller1#test.com',
'receiverList.receiver(1).amount' => '90',
'requestEnvelope.errorLanguage' => 'en_US',
'currencyCode' => 'USD',
1.1) mystore#test.com and seller1#test.com both have the funds, they are refunded immediately.
1.2) mystore#test.com has the funds, but seller1#test.com does not. An eCheck is submitted from seller1#test.com's bank account to pay for the refund, and the status will be PENDING until it clears from the bank. mystore#test.com has only paid buyer#test.com 10USD. buyer#test.com will have two transactions, one for 10USD that is completed, and one for 90USD that is pending. If the 90USD transaction fails, PayPal will try a second time to represent to the bank. If it fails again, seller1#test.com's transaction should go into a FAILED status and may not be refunded via the transaction. The only way to refund this transaction would be to do a send money.
2) If you do not have API permission to submit the refunds for seller1#test.com you will not be able to pass his receiver in the request. If you do, the whole refund will fail. You cannot exceed the amount you were originally paid (10USD)
3) If the seller1#test.com is not confirmed, or does not have an account created in paypal/sandbox, the transaction will be PENDING , and while it is pending the buyer can click cancel next to the transaction. You may also cancel the transaction before it shows COMPLETED by submitting a refund for their amount.
If this was a chained payment it may have a different outcome.

Categories