#xfechx

1 messages ยท Page 1 of 1 (latest)

spring chasmBOT
rose niche
#

Hi there. What's the issue you are facing?

upbeat hill
#

Hi,

#

I have this include 'stripe.php'; $stripe = new \Stripe\StripeClient($secret_key, $connected_account); $stripe_promotion_code = $stripe->promotionCodes->update([ $stripe_promotion_code_id, [ 'active' => !$used, ] ], ['stripe_account' => $connect]);

#

but not working, so just want to make sure I have the format ok, I need to change the active parameter

rose niche
#

Can you share the request id so I can take a look?

upbeat hill
#

dont have it

rose niche
#

You don't have Dashboard access?

jolly frost
#

When you say its "not working" what do you mean?

#

Are you hitting an error, or is it not doing what you expect?

upbeat hill
#

i need only guidance/example like in how to write for updating active param with a connected account attached, a dummy skelleton is ok

jolly frost
#

Well what you have looks valid, which i why i ask if you're having issues, and can be more specific about that

upbeat hill
#

ok

jolly frost
#

What happens when you run that code?

upbeat hill
#

i dont see it in logs

jolly frost
#

Which logs?

upbeat hill
#

dashboard

jolly frost
#

Well it would be in the logs for the connected account, is that where you're looking?

upbeat hill
#

everywhere

#

connected account, platform, live, test

#

so not sure what is happening

jolly frost
#

Ok, so when running that request, can you log out the request id header from the result? Or share the connected account you're using so I can look for it?

upbeat hill
#

sure, can I give you the platform and account?

#

connected account: acct_1EVqvDLeN6kOhyrs

#

platform: acct_103xXp2lgzywWyEx

jolly frost
#

yea i'm not seeing update requests either -- only new promo code creation

#

Can you try running the same request using curl and share the request ID, and/or any errors?

upbeat hill
#

not sure how to add a connected account parameter to curl

#

can you please send me a skelleton in php of how to update the active field of a promotion code with a connected account, please?

#

is what I have been asking since beginning

#

ok got this:

#

(Status 404) Unrecognized request URL (POST: /v1/promotion_codes/). If you are trying to list objects, remove the trailing slash. If you are trying to retrieve an object, make sure you passed a valid (non-empty) identifier in your code. Please see https://stripe.com/docs or we can help at https://support.stripe.com/.

Explore our guides and examples to integrate Stripe.

#

I have no problems creating a promo code with almost the same code

#

for updating I get the error above

#

??

jolly frost
#

Catching up, just a sec

#

ok, that looks like your existing promo code id is missing

#

You alreayd have the skeleton, is what i'm saying, your code looks correct

#

Log and check the contents of $stripe_promotion_code_id -- that error suggests it might be empty

upbeat hill
#

it's not empty:

#

promo_1M4urGLeN6kOhyrsqDfAwq0u

jolly frost
#

ahhh ok

#

I think i see, can you try this:

$stripe_promotion_code = $stripe->promotionCodes->update(
      [
        'id' => $stripe_promotion_code_id, 
        'active' => !$used,
      ]
    , ['stripe_account' => $connect]);
#

note the id moved inside the first param array

#

err sorry, no nested array, fixing

upbeat hill
#

same error

#

throws me the same error

#

with this $stripe_promotion_code = $stripe->promotionCodes->update( [ 'id' => $stripe_promotion_code_id, 'active' => !$used, ] , ['stripe_account' => $connected] );

#

changed $connect, for $connected (it has the stripe_account_id)

#

but still not working with new edits you sent

#

get the same error

jolly frost
#

ok last try, i think i missed your extra [] and thought i did that:

#
 $stripe_promotion_code = $stripe->promotionCodes->update(
      $stripe_promotion_code_id, 
      [
        'active' => !$used,
      ]
    , ['stripe_account' => $connect]);
upbeat hill
#

working!

#

thanks a lot

#

what is the best way to mark promo codes as used

#

?

jolly frost
#

What do you mean by used?

upbeat hill
#

times_redeemed?

jolly frost
#

yes, exactly ๐Ÿ™‚

upbeat hill
#

is "times_redeemed" updateable?

jolly frost
#

No, that's tracked by redemptions Stripe sees

#

(checkout usage, etc)

upbeat hill
#

ok, so I cannot update it via API

jolly frost
#

Nope

upbeat hill
#

ok, thanks a lot for your help

#

that is all for now

#

cheers

jolly frost
#

NP! thanks for your patience -- have a good one