stripe fund transfer not working properly - php

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.

Related

Stripe connect subscription split fees

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.

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']
);

Stripe Creating Direct Charges to connect account

I am trying to use stripe Direct Charges and it's working when user user new card (with token id).
Problem: When trying with save customer id and save card id. When i am trying to charge with custom-id and source=> save card id It's giving error customer not exist. But Both customer and card id exist.
$charge = \Stripe\Charge::create([
"customer" => $userdata->stripe_id,
"amount" => $amount,
"currency" => "usd",
"source" => $findcard['card_id'],
"application_fee" => $fee,
], ["stripe_account" => $talent_stripeid]);
Error: No such customer: cus_EOwmc6nVmU7oNu
I was getting the same error and when reached out to Stripe support got the following answer which helped me to solve the issue:
The error you are running into is happening because the customer
object is on the platform account, but when you add the
"Stripe-account" parameter to your charge request, you're moving the
command to the connected account, and so can't reach the customer
object.
To make the customer available, you'll need to share the customer to
the connected account. You'll basically create a token or source from
the customer object on your platform, and then share that with the
connected account, to process a payment, or to save locally, so the
connected account can use it directly.
https://stripe.com/docs/connect/shared-customers
Alternatively, you can keep the customer information on your platform
account and perform Destination charges, just sending to the connected
account "their share" of the proceeds:
https://stripe.com/docs/connect/destination-charges

Transfer amount into customer's bank account using Stripe Payout API

I am working on an implementation of REST API for a mobile application which encapsulates feature of redemption of earned points in form of money equivalent to points using Stripe as a payment gateway .
To accomplish it I have used Stripe payout API to transfer amount directly into destination bank account.
Following is code snippet of call to payout API of Stripe
$payout=\Stripe\Payout::create(array(
"amount" => 400,
"currency" => "usd",
"destination"=>$ID,/* ID of customer bank account ba_1CIZEOCHXaXPEwZByNehIJrY */
"source_type"=>'bank_account'
));
Upon execution of above code snippet I receive error message as response to call of payout API
The bank account ba_1CIZEOCHXaXPEwZByNehIJrY is not attached to this
Stripe account. External accounts can only be attached to Standard
accounts via the dashboard.
According to above error message it seems that same bank account needs to be attached to both customer and connected stripe account but I am unable to find appropriate solution to attach customer's bank account to merchant as an external account.
Please suggest me an appropriate solution to it.
Actually you can use the Stripe payout API to initiate a payout to either a bank account or debit card of a connected Stripe account.However you can create a transfer , To send funds from your Stripe account to a connected account.
https://stripe.com/docs/api/transfers/create
Below is the php code :
\Stripe\Stripe::setApiKey("sk_test_AjtBCFvy8Ah0x5vLmd5Ntemi");
\Stripe\Transfer::create([
"amount" => 400,
"currency" => "usd",
"destination" => "acct_1CPuerJ18us5u9z6",
"transfer_group" => "ORDER_95"
]);
I have also searched stripe documentation , to directly transfer the payment in the third party card / bank account, but did not find anything.
With Stripe Connect, you can make API requests on behalf of connected accounts using the Stripe-Account header as documented here. This applies to any API requests from creating a Charge or a Payout to listing all Refunds.
This obviously assumes that you use Stripe Connect and that the person receiving funds from you has their own connected accounts. You also have to use Custom or Express accounts if you want to be able to control their Payouts. This is not allowed with Standard accounts.
The code would look like this:
$payout=\Stripe\Payout::create(array(
"amount" => 400,
"currency" => "usd",
"destination"=> "ba_XXXX" // bank account id
),
array(
"stripe_account" => "acct_XXXX" // id of the connected account
));
This obviously assumes that you are familiar with Stripe Connect and are actively using it. It would be the only way to handle this and you can read more about this feature here.

Categories