#BidBird®

1 messages · Page 1 of 1 (latest)

slow fogBOT
glass urchin
#

I don't think I understand the question

verbal beacon
#

ok, so, when we create a payment intent it generates a json object. Which is present on a page.

Then when a customer fills out their cc info I'm submitting the updated PI. When it's processed on the php server I'm unable to do $stripeIntent['id'] for instance as it's not a php array.

#

it's the structure of:

 $stripeIntent['id']

vs.

'{'$stripeIntent.setup_future_usage'}', 

I just don't know how to access the json object.

glass urchin
#

I'm not very savvy with PHP, but here's an example of retrieving a Payment Intent and printing paymentIntent[id]:

`$paymentIntent = $stripe->paymentIntents->retrieve(
'pi_1HruFYILwdSSnvJbjey4lywv',
[]
);

echo $paymentIntent->id;`

verbal beacon
#

ok, May I step back one step?

    public function charge($amount, $stripeIntent)    {//    try {            
return new PaymentIntent([                 'setup_future_usage' => '{'$stripeIntent.setup_future_usage'}',                'amount' => $amount,                
'id' => '{$stripeIntent.id}',                'payment_method' => '{$stripeIntent.payment_method}', 
           ]);        } catch (InvalidRequestException $e) {            throw new PaymentFailedException;        }    }

Is the correct thing to do after a customer submits a cc charge? We update the stripeIntent?

glass urchin
#

Are you following a guide right now?

verbal beacon
#

yes, was doing the upgrade guide from 2018 api

glass urchin
#

Can you post it?

verbal beacon
#

yes, I'm trying to find it again.

#
$payment_method = \Stripe\PaymentMethod::retrieve('{{PAYMENT_METHOD_ID}}');
$payment_method->attach(['customer' => '{{CUSTOMER_ID}}']);

So the last stripe dev said if I create a customer prior to the PI this step would not be necessary.

In the previous API, the charge() method would create a stripe charge and return it.

Is it necessary to return a PI, as I've tried above? I guess I'm not sure when the PI must be updated.

glass urchin
#

What step are you on and where is it going wrong?

glass urchin
#

Okay, and what's going wrong?

verbal beacon
#

so, according to step 2. after submitting the form I should retrieve:

No such PaymentMethod: '{{PAYMENT_METHOD_ID}}'
#

but get that error on this line:

$payment_method = \Stripe\PaymentMethod::retrieve('{{PAYMENT_METHOD_ID}}');
#

PaymentIntent json object has thus:

glass urchin
#

You need to replace {{PAYMENT_METHOD_ID}} with the actual Payment Method ID

verbal beacon
#
"payment_method": null,    
"payment_method_options": {        "card": {            "installments": null,            "mandate_options": null,            "network": null,            "request_three_d_secure": "automatic"        }    },    "payment_method_types": [        "card"    ],
#

Is it strange the PM does not have any more info above? That's related to this: pi_3MeRe0KT8fxib8XB1BmWzsxD I think I'm accessing the first payment intent not the amended one. That's what I was trying to do above, update the PI

#

ahh, I think this is where it's going not good:

public function update($amount){    
$intent = \Stripe\PaymentIntent::update(        '{{PAYMENT_INTENT_ID}}',        
['amount' => $amount]    
);    

echo json_encode(array('status' => $intent->status));}
#

how will the PI id get submitted on the await js fetch()?

#

the fetch seems like it needs to post the PI id, and the get it? is that right?

glass urchin
#

I have no idea what you're asking

#

You have said nothing so far about fetch() so I have no idea where you're making that call and couldn't answer that question unless I saw your whole integration.