#xwtk-payments
1 messages ยท Page 1 of 1 (latest)
Hey karllekko
@tacit skiff hi there! But yes, that's expected, for right now the links only support Cards, you need to integrate with the API to accept other methods.
Ah I see now! Is it possible to do PHP-only integration?
(without frameworks)
and a bit confusing here, should I include the vendor/autoload.php?
what do you call a framework exactly?
you can use PHP, and if you do you should use our library(https://github.com/stripe/stripe-php), but that's not really a framework I would say.
if you installed our library using Composer then yes you need that(same as with any other library your code is using via Composer)
Slim
there are ways to manually install/use the library instead, there's instructions on that github page
yes you don't have to use Slim if you don't want to
we used to use it in our examples but are trying to get rid of it since it just confuses people
yeah but another question arises ๐
I am reading but like
I am sorry I just don't understand what I should do haha
what's the question?
I just... like I don't know what to do in this part
alright @mossy wave so I installed Slim and Stripe-php
but now I get a Page Not Found
should I show part of my code?
you might want to hire a developer or stick with PaymentLinks or a third party integration overall.
For what it's worth I'd suggest not using Slim at all(not sure if it's in the example you're looking at, as I said we're trying to stop using it)
there are much easier ways to use Stripe, for example I'd just use Checkout
Because custom checkout flow is really confusing for me right now so trying to figure out
You mean Checkout Links?
<?php
require '../vendor/autoload.php';
$key = "sk_test_xxxxx";
\Stripe\Stripe::setApiKey($key);
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
echo 'Invalid request';
exit;
}
$checkout_session = \Stripe\Checkout\Session::create([
'success_url' => 'https://example.com/success.html?session_id={CHECKOUT_SESSION_ID}',
'cancel_url' => 'https://example.com/canceled.html',
'payment_method_types' => ["card"],
'mode' => 'payment',
'line_items' => [[
'price_data' => [
'currency' => 'usd',
'product_data' => [
'name' => 'T-shirt',
],
'unit_amount' => 2000,
],
'quantity' => 1,
]],
]);
header("HTTP/1.1 303 See Other");
header("Location: " . $checkout_session->url);
?>
like something as simple as that can work
Oh!
Oh this is RIGHT what I needed
How come I didn't find this
Also I can put customer email in the arguments right?
And set payment method types to auto
yes you can pass the arguments that are accepted for https://stripe.com/docs/api/checkout/sessions/create
got it
i do get the following error however
[Mon Jan 10 15:37:54.715631 2022] [proxy_fcgi:error] [pid 1321558:tid 139815563532032] [client 37.252.82.66:0] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught (Status 400) (Request req_mcAgLrV47v50ZJ) Received unknown parameter: automatic_payment_methods\n thrown in [redacted]/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php on line 38', referer: https://enterprise.xwtk.cloud/account/buy.php
try just removing that line entirely
I think you can just omit it and that implies automatic selection
automatic_payment_methods is for PaymentIntents too, not Checkout, so it's a different API, that's your confusion.
ah I see
thank you so much for the help
will give an update in a min or 2
also a question about GPay and Apple Pay, how can I put them in the arguments? or it just automatically shows (I already enabled them in Stripe Payment Methods)
oh and also @mossy wave how can I enable automatic_tax parameter so its paid by the customer
because
'enabled' => false,
'status' => null,
]],
returns invalid parameter
they show automatically, you don't have to enable them in the API call
got it and about the tax? so the customer pays it
for that invalid parameter error, can you share the request ID req_xxx for the error so I can see what you're doing and take a quick look at your account set up? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
even easier
just this
[Mon Jan 10 15:50:56.216206 2022] [proxy_fcgi:error] [pid 1321558:tid 139815496390400] [client 37.252.82.66:0] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught (Status 400) (Request req_Fm3wVKCpdIRMQB) Received unknown parameter: automatic_tax[0]\n thrown in [redacted]/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php on line 38', referer: https://enterprise.xwtk.cloud/account/buy.php
nevermind figured it out!
yeah I think you had too many [ ] if that was it
yeah
and what about tax_behavior
putting 'tax_behavior' => 'exclusive', returns invalid parameter req_BHprFlTIfzWzaa
ah seems like it needs to be in price data
huh nope
still returns the same error @mossy wave
btw my price currency is USD but my bank is EUR, will stripe be able to do the conversion and payout to the EUR bank?
it does need to be on the Price yes. https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-line_items-price_data-tax_behavior should work.
yes
great!
yeah but for some reason shoots out the same error
should I send you the request ID?
or part of code
'customer_email' => $_SESSION['user'],
'success_url' => $success,
'cancel_url' => 'https://enterprise.xwtk.cloud/account/buy.php?cancel',
'payment_method_types' => ["card","wechat_pay"],
'mode' => 'payment',
'tax_behavior' => 'exclusive',
'automatic_tax' => [
'enabled' => true,
],
'payment_method_options' => [
'wechat_pay' => [
'client' => "web"
],
],
'line_items' => [[
'price_data' => [
'currency' => 'usd',
'tax_behavior' => 'exclusive',
'product_data' => [
'name' => $_SESSION['product'],
],
'unit_amount' => $price,
],
'quantity' => 1,
]],
]);```
Request
req_ZMuEU1ld8GmXiC
you still have tax_behavior at the top level
oh my god
i missed it xD
so sorry hahaha
@mossy wave
[Mon Jan 10 16:20:39.137032 2022] [proxy_fcgi:error] [pid 1321558:tid 139815588710144] [client 37.252.82.66:0] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught (Status 400) (Request req_C8wOGPAaQ7Sj4W) The currency provided (usd) is invalid for one or more payment method types on this Checkout Session. The payment method type wechat_pay only supports the following currencies: .\n thrown in /home/admin/web/enterprise.xwtk.cloud/public_html/account/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php on line 38', referer: https://enterprise.xwtk.cloud/account/buy.php
any ideas?
i removed alipay for this too but wechat seems to have USD
(alipay actually too)
Checking on some things as that error seems misleading
sure
I don't think WeChat is supported in Greece: https://stripe.com/docs/payments/wechat-pay
and about alipay?
It's not enabled (or even offered) on your account
yeah its not offered
Do you have a specific error relating to Alipay?
yeah one second
Then why were you expecting it to work? ๐
i dont know hahaha i thought wechat pay didnt need even to be enabled
[Mon Jan 10 16:02:36.011654 2022] [proxy_fcgi:error] [pid 1321558:tid 139815362205440] [client 37.252.82.66:0] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught (Status 400) (Request req_9CNdQwyeYVgrI8) Invalid currency options ``usd``. The payment method `alipay` only supports the following currencies: ``cny`, `eur``.\n thrown in /home/admin/web/enterprise.xwtk.cloud/public_html/account/vendor/stripe/stripe-php/lib/Exception/ApiErrorException.php on line 38', referer: https://enterprise.xwtk.cloud/account/buy.php
while
depending on business location like it says.
ah hmm i see
in general Alipay/WeChat only work for CNY and your account's local currency(which is EUR for you if your account is in Greece), you can't charge in USD
https://stripe.com/docs/payments/alipay/accept-a-payment?platform=web#supported-currencies it is all in the docs so I'd encourage you to have a look a little before immediately posting the error here
thought it would be pretty great so absolutely everyone could pay but yeah
sure sorry haha
it worked!
so many thanks to all you guys, I really appreciate all the help!
Np!