Howto Stripe Payment integration

Helpful page as reference : https://www.codexworld.com/stripe-payment-gateway-integration-php/

Requirements / Installation:

  1. Register on Stripe. Download Stripe Classes https://github.com/stripe/stripe-php#manual-installation and extract it to your folder for example www\inc\YOUR-STRIPE-FOLDER
  2. You need a new Page where you add the Stripe Server Code and then add the required/include the stripe classes you downloaded and point to that folder with init.php like the screen here
    image
  3. On your page where you sell your products, lets call it productpage.php add the simple form button code which contains amount, public stripe token, currency etc. : image

Ok so far I’ve got now the Stripe Payment process but still need to catch the JSON payment results so I could store it into MYSQL db. Now what I’ve got is:

There are several methods of stripe integration. They even offer now a Beta with hosted landing page. So you’ll setup products on stripes side and just link your payment button to there.
Another way is to use the payment button (FORM), lets call it productpage.php where you’ll send that form with hidden price, public token etc via POST Action to a special prepared payment process with some php code. Lets call it paymentprocess.php where I’ll show you the screens below:

My productpage.php looks like :

My paymentprocess.php looks like that :

I’m getting back that JSON file as result:

Stripe\Charge JSON: { "id": "ch_xxxxxxxxxxxxI", "object": "charge", "amount": 999, "amount_refunded": 0, "application": null, "application_fee": null, "balance_transaction": "txn_xxxxxxxxxxxxxxxxx", "captured": true, "created": 1546070431, "currency": "usd", "customer": null, "description": "Example charge", "destination": null, "dispute": null, "failure_code": null, "failure_message": null, "fraud_details": [], "invoice": null, "livemode": false, "metadata": [], "on_behalf_of": null, "order": null, "outcome": { "network_status": "approved_by_network", "reason": null, "risk_level": "normal", "risk_score": 14, "seller_message": "Payment complete.", "type": "authorized" }, "paid": true, "payment_intent": null, "receipt_email": null, "receipt_number": null, "refunded": false, "refunds": { "object": "list", "data": [], "has_more": false, "total_count": 0, "url": "\/v1\/charges\/ch_xxxxxxxxxxxxxxxI\/refunds" }, "review": null, "shipping": null, "source": { "id": "card_1xxxxxxxxxxxxxxxxx", "object": "card", "address_city": null, "address_country": null, "address_line1": null, "address_line1_check": null, "address_line2": null, "address_state": null, "address_zip": null, "address_zip_check": null, "brand": "Visa", "country": "US", "customer": null, "cvc_check": "pass", "dynamic_last4": null, "exp_month": 11, "exp_year": 2021, "fingerprint": "Mxxxxxxxxxx", "funding": "credit", "last4": "4242", "metadata": [], "name": "fda@dd.de", "tokenization_method": null }, "source_transfer": null, "statement_descriptor": null, "status": "succeeded", "transfer_group": null }

As you can see the payments are properly catched into Stripe and we see that fda@dd.de User here :

Now my question is how to store the values / catch them? As I can see that form is using post method. Maybe I can use DMX input fields instead of that strange Script Form injection.

2 Likes

Did you solve the issue with storing the json data returned @Freddy_Blockchain?

Is some sort of Stripe integration still on the Wappler Roadmap? I only have one website left that is not Wappler but in order to redo it I need some sort of payment gateway integration.

One website and one dashboard to redo and I can uninstall Dreamweaver. :wink:

You looked at my tutorials Brad? It’s pretty simple to interface with.
Last I heard the line was it’s just another API, no specific integration was planned as it’s just another API solution.

I can’t seem to figure out how to use any API stuff. Especially the Stripe one. I looked at it and have no idea where to even start.

Take a look at my walk though’s in the eCommerce section

I am NOT an API expert but i actually found it quite straightforward

If you need help please ask, i will do my best to assist in any way I can

Thanks Brian, I think I have seen it already but I will have another look.

Edit: Yes, I have seen that documentation. Way beyond my capabilities. Basically my use case is to sell theatre tickets online. Each production usually has 8-12 performances. A couple nights are usually a cheaper night.

I really don’t want the customer to have to create a profile. I don’t see any way to add items to a cart or anything in those docs?

The way the Paypal DMXZone DW extension works was perfect for us.