#Rahim Dobani

1 messages · Page 1 of 1 (latest)

muted cliffBOT
fresh tusk
#

Hello

midnight dust
#

Hi

fresh tusk
#

What dos "not working" mean?

#

Do you have a request ID with an error?

midnight dust
#

Its not updating customer

#

{
"customerID": "cus_OiP3YL5RVYNpnU",
"email": "rahim@gmail.com",
"name": "rahimdobani"
}
this is req
{
"customer": {
"id": "cus_OiP3YL5RVYNpnU",
"object": "customer",
"address": null,
"balance": 0,
"created": 1695823060,
"currency": null,
"default_source": null,
"delinquent": false,
"description": null,
"discount": null,
"email": "use12r@gmail.com",
"invoice_prefix": "BC33A651",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": "pm_1NuyNpAOo6YEPSo0FOWbvBAW",
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {},
"name": "Rafiyaaa12122",
"next_invoice_sequence": 1,
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
},
"success": true
}
this is response

#

its not updating email and name

fresh tusk
#

Have you looked in your Dashboard for the actual request?

#

Have you hardcoded a Customer ID instead of using a variable?

midnight dust
#

const customer = await stripe.customers.update(
"cus_OiP3YL5RVYNpnU",
{
description: '(created by Stripe Shell)',
name: 'Jenny Rosen',
email: 'example@website.com',
}
);

#

yeh i have hardcoded customer ID

#

Is function i am calling right? or have some error?

fresh tusk
#

The best thing is to look in your Dashboard for exactly what is happening.

#

Which is a Customer update for that customer but nothing is being passed in the body of the request

#

So there is some issue with your parameters. Either your code isn't saved or something else. But those parameters aren't coming through

midnight dust
#

Yess, am i passing email and name correctly in params of function?

#

Or is syntax of code wrong?

fresh tusk
#

No the syntax looks fine above, otherwise it would error.

midnight dust
#

i have another question how can i get card ID

#

?

fresh tusk
#

Can you elaborate?

midnight dust
#

const cards = await stripe.paymentMethods.list({
customer: customerID,
type: 'card',
});
i am using this method to retrieve card but not getting card ID

#

{
"cards": {
"object": "list",
"data": [
{
"id": "pm_1NuyinAOo6YEPSo0zM30iLsX",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": "PK",
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": null,
"name": null,
"phone": null
},
"card": {
"brand": "visa",
"checks": {
"address_line1_check": null,
"address_postal_code_check": null,
"cvc_check": "pass"
},
"country": "US",
"exp_month": 12,
"exp_year": 2029,
"fingerprint": "hpxT9s6BC5uhUy15",
"funding": "credit",
"generated_from": null,
"last4": "4242",
"networks": {
"available": [
"visa"
],
"preferred": null
},
"three_d_secure_usage": {
"supported": true
},
"wallet": null
},
"created": 1695824893,
"customer": "cus_OiPXBGt5v6Iibs",
"livemode": false,
"metadata": {},
"type": "card"
}
],
"has_more": false,
"url": "/v1/payment_methods"
},
"success": true
}
getting this response but can't find card id

#

I want to use card id in delete method.

fresh tusk
#

You don't need the Card ID. That is an underlying object that you should mostly ignore. You just use the PaymentMethod ID here.

midnight dust
#

const deleted = await stripe.customers.deleteSource(
customerID,
cardID
);
so in delete api in instead of card ID i will use pmID?

fresh tusk
midnight dust
#

First i will detach payment method then i will delete it?

fresh tusk
#

Detaching does "delete" it.