As far as I understand, regarding the Stripe transfers, you are able to send money to a credit card / bank account, even if those isn't registered with Stripe.
Following their API, I've come up with below code to send money to a credit card:
$amount = inputFilter($_POST['amount']);
$amount = $amount*100;
$destination = "card_6WWSXFfQsZEc66"; //Card data is a test card
#$customer = \Stripe\Customer::retrieve($userdata["stripe_id"]);
$transfer = \Stripe\Transfer::create(array(
"amount" => $amount,
"destination" => $destination,
"description" => "test payment"
));
$event_id = $tranfer->id;
$event = \Stripe\Event::retrieve($event_id);
die($event);
The response I am getting from above PHP code is this:
The card card_6WWSXFfQsZEc66 is not attached to this Stripe account.
External accounts can only be attached to standalone Stripe accounts
via the dashboard.
Have I misunderstood something? Aren't you supposed to be able to transfer funds from your own Stripe account to standalone bank/credit cards?
As far as I understand, regarding the Stripe transfers, you are able to send money to a credit card / bank account, even if those isn't registered with Stripe.
Actually, you cannot send money to a credit card or bank account if it is not linked to a connected account.
Related
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.
I was wondering for a bit of clarification and help regarding Stripe.
Basically, I have the following:
//get the card token from the stripe request
$customerTok = request('stripeToken');
//create the customer with this token
$customer = \Stripe\Customer::create(array(
"email" => \Auth::user()->email,
"source" => $customerTok,
));
Where customerTok is the bank token passed by Stripe.js (entering their card number, cvc and exp date), and I'm creating the customer in my Stripe Dashboard.
$cardTok = \Stripe\Token::create(array(
"card"=>$customer->sources->retrieve(default_source),
));`
Then I grab a token for their card? (I think this is wrong but this is the principle?)
I now need to make them into a connect managed account (I need users to be able to pay each other, like eBay)
$account = \Stripe\Account::create(
array(
"country" => "GB",
"managed" => true,
"external_account"=>$customer->id,
));
Obviously this isn't production ready code, I'm just trying to understand the flow and if I'm understanding this correctly.. Can anyone explain why this isn't working right now and what I'm getting wrong?
Thanks,
Generally, you cannot retokenize payment information from saved customers (outside of specific scenarios).
Note also that Stripe can only do payouts to debit cards (not credit cards), and only in the US. In all other countries, Stripe can only do payouts to bank accounts.
If your platform's users are both buyers and sellers, you will need to create two different resources for each of them:
a customer object to act as a payment source (when the user buys something)
an account object to act as a payment destination (when a user sells something)
I recommend that you reach out to Stripe's support at https://support.stripe.com/email to explain your business model so that you can receive personalized advice for your integration.
The scenario is there are 3 users in our website, Admin, Sender and Receiver.
Sender send payments to Receiver, but in our website Sender not directly send the payment to Receiver, the amount holds on Admin Stripe account and after the confirmation Receiver receive the payment from Admin Stripe account. For this process I create a platform from Admin Stripe Account , now Sender and Receiver both are connected to that platform.
Below are the codes we are using:
Sender Send Payment To Admin Strip Account
\Stripe\Stripe::setApiKey("sk_test_ADMIN_KEY");
\Stripe\Charge::create(array(
"amount" => 400,
"currency" => "usd",
"source" => "tok_18uL5yIXv4Heg2KDdPHJFo8A", // obtained with Stripe.js
"description" => "Charge for abigail.white#example.com"
));
Receiver Receive Payment From Admin Stripe Account
\Stripe\Stripe::setApiKey("sk_test_ADMIN_KEY.....");
\Stripe\Charge::create(array(
'amount' => 400,
'currency' => 'usd',
'source' => $token,
'destination' => 'acct_...' //
));
and more all of three users have their stripe accounts, and on test mode all of three have $0 Available Balance. and Amount is not added to Receiver Stripe Account after using the above code.
When accepting payments on behalf of third-parties, you cannot hold funds on the platform's account ("Admin"). For compliance reasons, you must set the destination account when you create the charge.
\Stripe\Stripe::setApiKey("sk_test_..."); // platform's API key
\Stripe\Charge::create(array(
'amount' => 400,
'currency' => 'usd',
'source' => $token,
'destination' => 'acct_...' // connected account's ID
));
This will charge the customer (via the payment method in $token) and add the funds to the connected account's balance. Once the funds become available, they can be transferred account to the connected account's associated bank account.
Note that because this charge is created "through the platform" (i.e. with the destination parameter), the platform will pay Stripe's fees and be responsible for chargebacks and refunds (cf. here). Because there is no application_fee parameter, the platform will effectively lose money on this transaction, as it will pay for Stripe's fees but not receive anything.
If you're using managed accounts, then you (as the platform) are also in control of transfers to the associated bank account. You can read more about this here.
With standalone accounts, the platform does not have control over bank transfers -- instead, each standalone account's owner does, via their own account settings.
I'm trying to implement payments with Stripe, i'm using Stripe connect.
I'm reading documentation for "Charging through the platform" and it says:
\Stripe\Stripe::setApiKey(PLATFORM_SECRET_KEY);
\Stripe\Charge::create(array(
'amount' => 1000,
'currency' => 'gbp',
'source' => {TOKEN},
'destination' => {CONNECTED_STRIPE_ACCOUNT_ID}
));
I have the PLATFORM_SECRET_KEY, and the CONNECTED_STRIPE_ACCOUNT_ID (Obtained from oauth flow with stripe connect), but what is the needed TOKEN?
I have readed that a token can be obtained from a "stripe form", but what is the point to "connect" the stripe account if i need to request card data to my users?
Do I missed something from the flow?
Is there a way to create a token from the user account?
Do i need to create a customer?
Note: I'm newbie with stripe payments.
Stripe Connect is used to create charges on behalf of your users. Let's say you're a marketplace for example, you allow John to sell lamps online. Then, Alice comes and wants to buy a lamp from John on your website. You use the code you mentioned before to charge Alice and send the funds to John's account directly.
It looks like what you want here though is to charge Alice for yourself instead. Alice doesn't need a Stripe account in that case. You need to collect Alice's card details using Stripe Checkout or building your own form using Stripe.js. This will give your a card token tok_XXX that you then send to your server where you use it to create a charge through the API as explained in the charges tutorial.
I created a PayPal account and also created a sandbox personal account as well as business account.
From business account api credentials I got username:111abc.org , pwd :111, signature:A--hhshshhhhshsss. Using these details from test accounts I Formatted my API requests '
define('API_USERNAME', '111abc.org');
define('API_PASSWORD', '111');
define('API_SIGNATURE', 'A--hhshshhhhshsss');
define('API_ENDPOINT', 'https://api-3t.sandbox.paypal.com/nvp');
define('PAYPAL_URL', 'https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token=');
when I logged into the paypal account in my site it shows for adding the credit card no:, I copied it from business account api credentials ,But it shows an error like this
This credit card has been denied by the bank that issued your credit card.
For details on why your card was denied, please contact your credit card issuer's customer service department. Or, you may want to try adding a different credit card.
How can I test my paypal with sandbox account?
Try using another test credit card number, you can generate these from the sandbox. Otherwise, I provided some test Visa credit card numbers below.
4024007128707576
4539805151652124
4539139443918832
4716590741304528
4929181369786890
4539585085827139
4024007104385751
4485728803730862
4716879534966209
4556279316725340