Troubles setting up Stripe API

Has anyone been able to get this api to work? I am having all sorts of trouble and I have done it exactly the same way every time. Do I need to setup anything on my server to get this working?

I will have a run through when I get a chance in case stripe gave changed something since the guide was written

great thank you, I appreciate it

This could all be solved with a Stripe integration in Wappler … (Hint, hint) :wink:

1 Like

Just tested it, API worked perfectly. Here are the API settings. What exactly “doesn’t work”

Any questions, ask

(I assume your API key is valid)

Just a heads up, if you’re serving any users in and around Europe in the future, you’ll need to transition your Stripe integration to be SCA compliment - https://stripe.com/docs/strong-customer-authentication

You’ll need to start using the Payment Intents API to be compliant in the future.

Yes, that is required for payments but does not effect customer creation like this, I really need to update the payments tutorial at some time!

1 Like

Well, I still cant get mine to work I can fetch the API scheme which works but when I try to run the form i created nothing, here is my server action could you see if it looks ok:

<?php
require('../../../dmxConnectLib/dmxConnect.php');


$app = new \lib\App();

$app->define(<<<'JSON'
{
  "settings": {
    "options": {}
  },
  "meta": {
    "options": {},
    "$_POST": [
      {
        "type": "text",
        "name": "name"
      },
      {
        "type": "text",
        "name": "email"
      },
      {
        "type": "text",
        "name": "password"
      }
    ]
  },
  "exec": {
    "steps": [
      "Connections/connection1",
      {
        "name": "validate1",
        "module": "validator",
        "action": "validate",
        "options": {
          "data": [
            {
              "name": "email",
              "value": "{{$_POST.email}}",
              "rules": {
                "db:notexists": {
                  "param": {
                    "connection": "connection1",
                    "table": "customer",
                    "column": "email"
                  }
                }
              },
              "fieldName": "email"
            }
          ]
        }
      },
      {
        "name": "api1",
        "module": "api",
        "action": "send",
        "options": {
          "url": "https://api.stripe.com/v1/customers",
          "method": "POST",
          "params": {
            "email": "{{$_POST.email}}",
            "description": "{{$_POST.name}}"
          },
          "headers": {
            "authorization": "Bearer sk_test_jJ14InI56ViQUovM7Tr9IAZP006LpDq1R6"
          }
        },
        "output": true
      },
      {
        "name": "",
        "options": {
          "comment": "insert ninto customer table"
        }
      },
      {
        "name": "insert1",
        "module": "dbupdater",
        "action": "insert",
        "options": {
          "connection": "connection1",
          "sql": {
            "type": "insert",
            "values": [
              {
                "table": "customer",
                "column": "name",
                "type": "text",
                "value": "{{$_POST.name}}"
              },
              {
                "table": "customer",
                "column": "email",
                "type": "text",
                "value": "{{$_POST.email}}"
              },
              {
                "table": "customer",
                "column": "password",
                "type": "text",
                "value": "{{$_POST.password.sha256(\"pa$word\")}}"
              },
              {
                "table": "customer",
                "column": "stripeID",
                "type": "text",
                "value": "{{api1.data.id}}"
              }
            ],
            "table": "customer",
            "query": "INSERT INTO customer\n(name, email, password, stripeID) VALUES (:P1 /* {{$_POST.name}} */, :P2 /* {{$_POST.email}} */, :P3 /* {{$_POST.password.sha256(\"pa$word\")}} */, :P4 /* {{api1.data.id}} */)",
            "params": [
              {
                "name": ":P1",
                "type": "expression",
                "value": "{{$_POST.name}}"
              },
              {
                "name": ":P2",
                "type": "expression",
                "value": "{{$_POST.email}}"
              },
              {
                "name": ":P3",
                "type": "expression",
                "value": "{{$_POST.password.sha256(\"pa$word\")}}"
              },
              {
                "name": ":P4",
                "type": "expression",
                "value": "{{api1.data.id}}"
              }
            ]
          }
        },
        "meta": [
          {
            "name": "identity",
            "type": "text"
          },
          {
            "name": "affected",
            "type": "number"
          }
        ]
      }
    ]
  }
}
JSON
);
?>

This does not look right. I could be wrong but it seems to me that you may not have your project and file structure set up properly.

Can you supply a screenshot of your file/folder structure from your files panel?

Please don’t waste your time posting PHP, please show actions as I did above which actually tell us what you are doing

Did you check the stripe logs to see if the request was received by stripe and did stripe maybe return an error?

Yes I did check the logs and it does not connect at all. If i click on the fetch schema it does show a connection but not from the form.

Here is my action statement

1 Like

I have added a video to the end of the how to tutorial, please watch and learn, Follows the guide and works perfectly

1 Like