mll
05/23/2017, 5:09 PMnilan
05/23/2017, 5:09 PMnilan
05/23/2017, 5:10 PMmll
05/23/2017, 5:19 PMnilan
05/23/2017, 5:30 PMnilan
05/23/2017, 5:30 PMmll
05/23/2017, 5:32 PMnilan
05/23/2017, 8:10 PMmll
05/24/2017, 3:09 AMquery {
user {
id
stripeCustomerId
stripeCustomer
}
}
Where stripeCustomerId would be saved on graphcool and stripeCustomer would be equal to the object returned by the Stripe API for this customer (https://stripe.com/docs/api/node#retrieve_customer):
{
"id": "cus_AiG2iGbb9IQdzu",
"object": "customer",
"account_balance": 0,
"created": 1495593991,
"currency": "usd",
"default_source": "card_1AMpW82eZvKYlo2Csqq8T4tc",
"delinquent": false,
"description": null,
"discount": null,
"email": "<mailto:tests+1495593987@showclix.com|tests+1495593987@showclix.com>",
"livemode": false,
"metadata": {},
"shipping": null,
"sources": {
"object": "list",
"data": [
{
"id": "card_1AMpW82eZvKYlo2Csqq8T4tc",
"object": "card",
"address_city": "Pittsburgh",
"address_country": "US",
"address_line1": "414 Grant St",
"address_line1_check": "pass",
"address_line2": "",
"address_state": "PA",
"address_zip": "15219",
"address_zip_check": "pass",
"brand": "Visa",
"country": "US",
"customer": "cus_AiG2iGbb9IQdzu",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 12,
"exp_year": 2022,
"fingerprint": "tiDP36QdYA6X7km8",
"funding": "unknown",
"last4": "1111",
"metadata": {},
"name": "Harold Hamburger",
"tokenization_method": null
}
],
"has_more": false,
"total_count": 1,
"url": "/v1/customers/cus_AiG2iGbb9IQdzu/sources"
},
"subscriptions": {
"object": "list",
"data": [],
"has_more": false,
"total_count": 0,
"url": "/v1/customers/cus_AiG2iGbb9IQdzu/subscriptions"
}
}mll
05/24/2017, 4:51 PMnilan
05/24/2017, 4:53 PMnilan
05/24/2017, 4:53 PMnilan
05/24/2017, 4:55 PMUser type, make the call to the Stripe API from the PRE_WRITE hook point of the request pipeline and return the customer for the stripeCustomer fieldmll
05/24/2017, 5:02 PMnilan
05/24/2017, 5:02 PMmll
05/24/2017, 5:08 PMnilan
05/24/2017, 5:08 PMmll
05/24/2017, 5:09 PM