#santiago-checkout-returnurl

1 messages · Page 1 of 1 (latest)

hallow krakenBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

celest tree
#

santiago-checkout-returnurl

#

@daring grail there are no variables. Usually you have your own cookie logic to recognize who that customer is, what Session you created for them, etc.

daring grail
#

I understand that koopajah, but I thought it'll also return something else to check for or checkout session as well ? if is valid? reason for that is because I do not want the customer access the 'success' page directly becaues i do have to create the cookie before the payment. but nothing stop customer for just not paying and going directly on success page by typing on the url. and accessing the session..

celest tree
#
  1. I go on your website, you track me
  2. You send me to Checkout
  3. I pay
  4. I get sent back to your success_url
  5. Your code you wrote knows who I am, you tracked me at step #1 so you know what I was paying for, you have my Checkout Session id stored in your database for example
    At that point you can check it in the API, confirm I paid, etc.
daring grail
#

yes that's what i needed.. so i can access the chckout session id

#

thanks for the link iw as looking for them but coudlnt find them before

hallow krakenBOT
daring grail
#

for the second link, where can I see docs of stripe library to see what other classes I have access to? can't find it.. but for example. the one that says $customer->name , etc what where can I see all the options

twin socket
#

Hi, do you want to see in PHP only? It has a Github repo

daring grail
#

yes php only is fine, where is the github repo? is for stripe hosted pages, i basically need to access the checkout.session.completed after the return to success

twin socket
daring grail
#

quick clarification, if i used the stripe hosted page, i won't be able to use the @file_get_contents('php://input'); that' shows on the first link to grab data, correct?

twin socket
#

Yeah. Stripe Checkout Session only needs redirection

daring grail
#

ok, and on redirection how i can track the checkout.session.completed so i know paid went through, i've read the github page but didn't find it, maybe i didn't read correctly. Also, as soon as a 'back button' is press.. does the session close, do i have to close it manually ?.

#

actually, before trying anyting , I tried the demo with customized success page, and i get this error

#

Fatal error: Uncaught Stripe\Exception\InvalidArgumentException: The resource ID cannot be null or whitespace. in /home/www/vendor/stripe/stripe-php/lib/Service/AbstractService.php:105 Stack trace: #0 /home/www/vendor/stripe/stripe-php/lib/Service/CustomerService.php(277): Stripe\Service\AbstractService->buildPath('/v1/customers/%...', NULL) #1 /home/www/guesthostad.lcsitmedia.com/success.php(7): Stripe\Service\CustomerService->retrieve(NULL) #2 {main} thrown in /home/www/vendor/stripe/stripe-php/lib/Service/AbstractService.php on line 10

twin socket
#

Not sure about the error, you would want to put some debug around /home/www/guesthostad.lcsitmedia.com/success.php(7): Stripe\Service\CustomerService->retrieve(NULL) to see how it is getting NULL

daring grail
#

will check and see if i can figure it out.. I did see that link trying to use it with the session_id forward instead since i'm using stripe hosted redirect.

cunning bay
#

Hey, In my shop, only Mastercard works and not Klarna, Apple Pay, etc., even though it's active in Stripe. What can i do?

daring grail
#

Also, i get this error with 'HTTP_STRIPE_SIGNATURE

#

i'm using stripe hosted

#

Notice: Undefined index: HTTP_STRIPE_SIGNATURE in /home/www/guesthostad.lcsitmedia.com/success.php on line 6

twin socket
#

Looks like your request headers get stripped out somewhere. Do you use a language framework?

daring grail
#

no, plain php

#

i can send you the code (it is straight from the demo to test)

#

havent added any error handling yet. as i'm just trying to make it work, i'm guessing to use the webhook i have to add it on the dashboard? to get the checkout.session.completed?

twin socket
#

Please mask/remove your secret key value sk_test_xxx in your message

#

You shouldn't share secret key in a public place

daring grail
#

true, forgot it is just a test key will do

#

<?php
require '../vendor/autoload.php';
$stripe = new \Stripe\StripeClient('*******');
print_r($GET['session_id']);
$event = null;
$sig_header = $SERVER['HTTP_STRIPE_SIGNATURE'];
$endpoint_secret = "wec
";
try {
$session = $stripe->checkout->sessions->retrieve($_GET['session_id']);
print_r($session);
//print_r(checkout.session.completed);
//$customer = $stripe->customers->retrieve($session->customer);
// echo "<h1>Thanks for your order, $customer->name!</h1>";
http_response_code(200);
} catch (Error $e) {
http_response_code(500);
echo json_encode(['error' => $e->getMessage()]);
}

try {
$event = \Stripe\Webhook::constructEvent(
$session, $sig_header, $endpoint_secret
);
} catch(\UnexpectedValueException $e) {
// Invalid payload
http_response_code(400);
exit();
} catch(\Stripe\Exception\SignatureVerificationException $e) {
// Invalid signature
http_response_code(400);
exit();
}
?>

#

i think i understand it now , webhook is a separate page i thought all was in the same one..

twin socket
#

Yes, and your code is a bit odd that it tries to Retrieve Checkout Session before construct event

daring grail
#

yes I was just testing directly from the demo code to have an idea how your api works, will puti n order after.. it is using stripe_hosted so it has a success_url on it. but if i Use webhook, the webhook, i'll redirect from webhook instead from the stripe url?