#AntonioT

1 messages ยท Page 1 of 1 (latest)

restive pythonBOT
elder gazelle
#

Hi ๐Ÿ‘‹

Can you provide a little. more description of what is going on here?

  1. What is the difference in behavior you are seeing?
  2. What is the difference between Test & Live environments?
modern violet
#
  1. in test environment the subscription is created once the user authorice the payment, but in production when a user scan the qr code the subscription is not created
  2. by test & live environment im talkin about the switch that you have to be able to make test on our integrations
elder gazelle
#

I didn't mean Stripe's test & live mode, I meant the code & hosting environment for your production app vs staging

modern violet
elder gazelle
#

And the hosting environment is the same?

#

Do you have examples of the Subscription creation request for both test & live so I can check?

modern violet
modern violet
#
    params := url.Values{}

    params.Add("confirm", `true`)
    params.Add("customer", customerID)
    params.Add("payment_method_data[type]", `alipay`)
    params.Add("metadata[price_id]", priceID)
    params.Add("metadata[uuid_user]", uuidUser)
    params.Add("metadata[plan]", "personal")
    params.Add("payment_method_options[alipay][currency]", `usd`)
    params.Add("payment_method_types[]", `alipay`)
    params.Add("usage", `off_session`)
    params.Add("mandate_data[customer_acceptance][type]", `online`)

    params.Add("mandate_data[customer_acceptance][online][ip_address]", ipAddress)
    params.Add("mandate_data[customer_acceptance][online][user_agent]", userAgent)
    params.Add("return_url", redirectURL)
    body := strings.NewReader(params.Encode())

    req, err := http.NewRequest("POST", "https://api.stripe.com/v1/setup_intents", body)
    if err != nil {
        log.Println(err)
        return "", err
    }
    req.SetBasicAuth(key, "")
    req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        log.Println(err)
        return "", err
    }
    defer resp.Body.Close()

    bodyBytes, err := ioutil.ReadAll(resp.Body)

that is the code that im using to create a recurrent payment, in test environment that creates a subscription

#

but in live it doesnt and i not sure why

#

is the same code in live and test

elder gazelle
modern violet
#

this is req_zFUaEZZSaCrTzQ a test one

#

that creates a subscription

#

req_jnJanke6TZQohg and not sure why but in this one it doesnt create a subscription

elder gazelle
#

Great, thanks!

#

Okay the first request is to /v1/subscriptions to create a Subscription. The second request is to /v1/setup_intents to create a Setup Intent

modern violet
#

mmmmm

#

the thing is that

#

the first one

#

also creates the subscription

#

but the second one

#

the flow stop

#

on the setup intent

#

not sure why

#

if is the same code on both

elder gazelle
#

The setup intent reaches a status of requires_action where the customer needs to authetnticate with alipay.

modern violet
#

ohhhhh wait o just saw the issue

#

my bad

#

so sorry for wasting

#

your time

elder gazelle
#

It then succeeds async

modern violet
#

i forgot to config a webhook

#

xd

#

so sorry!

elder gazelle
#

No worries! It's why we are here ๐Ÿ™‚

modern violet
#

thank you so much

#

for your time

elder gazelle
#

Happy to help ๐Ÿ™‚