#workshare-devnull_connect-card-present

1 messages ยท Page 1 of 1 (latest)

night sailBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1339276587400433708

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

full flame
#

Hi ๐Ÿ‘‹

Sorry but your questions are all over the place. We can only answer questions about coding integrations with Stripe APIs here.

#

You can use Stripe Connect with Stripe Terminal to facilitate card-present payments though

twilit violet
#

can we use a generic card reader?

full flame
#

No. Stripe will only allow the use of Stripe terminal readers for card-present payments

twilit violet
#

okay. how about online/keyed payments. Am I understanding correctly that we could use Stripe.JS to tokenize a card before sending that token to our server to process payment on behalf of a connected account?

full flame
#

The createToken method in Stripe.js still requires a Stripe UI, in this case CardElement in order to tokenize the payment method.

twilit violet
#

so the checkout must be stripe hosted?

#

sorry if my questions are dense - heavy learning curve from using authorize.net

full flame
#

Not necessarily. You can use Stripe.js to create the inputs directly on a site you control

twilit violet
#

this code seems to work to give me a token in test mode

stripe.createToken(card).then(function(result) {
if (result.error) {
console.error(result.error.message);
} else {
// Send token to the server
fetch("teststripe.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ token: result.token.id, amount: 1000, currency: "usd" })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
}
});

#

but then i'm not sure what to do with the token

#

(i'm using the php stripe api)

full flame
#

I think you might be using a deprecated and undocumented approach here.

#

As for what is recommended for taking card payments, we have our Web elements documented here

twilit violet
#

i see, yes, I think my code is using a web element to collect and send the card for tokenization. Am I still understanding correctly that I send the token for payment server-side using my private key and the connected account's id?

full flame
#

That depends on what Connect funds flow you are using.

#

There are multiple different types, which we describe here

twilit violet
#

direct charge. we're invoicing software (middleman) for a business to directly invoice customers.

#

like freshbooks

full flame
#

Okay so you would need to create the token client-side on the Connected Account as well. To do that you will need to initialize Stripe.js with the Connected Account.

twilit violet
#

how would i retrieve the publishable key from a connected account?

full flame
#

You don't

#

You use your own publishable key and provide the Account ID.

#

Please review the link I shared

twilit violet
#

sorry i misunderstood the link. so it's okay for an accountid to be published

full flame
#

Yes

#

Because you are using Direct Charges, that means all the records (including the token) need to be created on the Connected Account

twilit violet
#

gotcha. this works and i was able to pass a token for a charge and it worked server side!

#

well, at least in test mode!

full flame
#

By adding the Connect Account ID when initializing Stripe.js, you ensure that is where Stripe objects get created

var stripe = Stripe(('pk_XXXX', {stripeAccount: 'acct_XXXX'})
twilit violet
#

Is it okay to store tokens from Stripe.JS for recurring bills?

full flame
#

Tokens are consumed as soon as they are charged. They are only good for a single use

twilit violet
#

gotcha. So instead send the token to \Stripe\PaymentMethod::create

#

to save for future payments

#

?

full flame
#

In order to re-use payment methods, you need to attach them to Customers before they are charged.

twilit violet
#

awesome. I really appreciate your help I think this got me going in the right direction. One last question ! If we want to do card present transactions, I need to pick out a server-driven stripe terminal and those are compatible with connected accounts?

full flame
#

Yes and Yes. We have a specific doc about using Terminal with Connect here. I think this is just what you are looking for.

twilit violet
#

thanks for your help. you've been very patient with me and I appreciate that

full flame
#

Happy to do it ๐Ÿ™‚ It's why we're here.