I have a website with a membership with 3 pages, one for presenting the membership (with my PayPal button), one with registration form (for adding the member in my database) and a last one when all this is complete( say " you can now login ").
I just followed a video on YouTube to add the PayPal button for my member to pay an amount before starting filling the registration form.
I am using PayPal SDK. Here is my code:
FIRST PAGE (account-step1.php)
I see this is a client-side only integration for payment creation and capture, where then after that client-side capture you use a server=side AI call to get the details of the order. That's a very strange hybrid, one wonders why you didn't integrate 'Set Up Transaction' and 'Capture Transaction on the server side (and paired with the approval JS for a server side integration) to get all the benefits of that robustness, and then you wouldn't need an additional API call to get the details of the order since you would already have it after the server-side capture and be able to store it atomically. Basically, it seems you really should switch to that instead of this unnecessary hybrid you're trying to do.
But if you insist on doing weird and inadvisable things that nobody recommends, Order IDs like 7KM15574UC313712P weren't created by your server-side code, and so can't be accessed that way. What you can try instead is to look up the successful Capture ID (not Order ID) in the JS, from
purchase_units.captures.id , and pass this actual PayPal transaction ID to your server code instead. Then use it to get the v2/payment capture object, which will use a different API/SDK call -- in your case, this one: https://github.com/paypal/Checkout-PHP-SDK/blob/develop/lib/PayPalCheckoutSdk/Payments/CapturesGetRequest.php
(But again, ideally this whole paragraph would be moot and you would pay more attention to paragraph #1)
Share solution ↓
Link To Answer People are also looking for solutions of the problem: cannot use isset() on the result of an expression (you can use "null !== expression" instead)
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
About the technologies asked in this question
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
CSS (Cascading Style Sheets) is a formal language for describing the appearance of a document written using a markup language.
It is mainly used as a means of describing, decorating the appearance of web pages written using HTML and XHTML markup languages, but can also be applied to any XML documents, such as SVG or XUL.
HTML (English "hyper text markup language" - hypertext markup language) is a special markup language that is used to create sites on the Internet.
Browsers understand html perfectly and can interpret it in an understandable way. In general, any page on the site is html-code, which the browser translates into a user-friendly form. By the way, the code of any page is available to everyone.
Welcome to programmierfrage.com
programmierfrage.com is a question and answer site for professional web developers, programming enthusiasts and website builders. Site created and operated by the community. Together with you, we create a free library of detailed answers to any question on programming, web development, website creation and website administration.
Get answers to specific questions
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Help Others Solve Their Issues
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.