#million1156

1 messages ยท Page 1 of 1 (latest)

barren oysterBOT
stray ivy
somber night
# stray ivy Are you able to view the Checkout Sessions in your account logs when you log int...

I can, here's a semi-redacted POST body (this seems to have the information that I'd like:

{
  "line_items": {
    "0": {
      "price_data": {
        "unit_amount": "100",
        "currency": "USD",
        "product_data": {
          "description": "this was the description of the item",
          "name": "this was the name of the item"
        }
      },
      "description": "this was the description of the item",
      "quantity": "1"
    }
  },
  "cancel_url": "https://REDACTED.com",
  "customer": "cus_Osa8up2JIPlaQq",
  "payment_intent_data": {
    "application_fee_amount": "3"
  },
  "success_url": "https://REDACTED.com/success?sessionId={CHECKOUT_SESSION_ID}",
  "mode": "payment",
  "client_reference_id": "736316"
}```


And here's the response body:
```json
{
  "id": "redacted",
  "object": "checkout.session",
  "after_expiration": null,
  "allow_promotion_codes": null,
  "amount_subtotal": 100,
  "amount_total": 100,
  "automatic_tax": {
    "enabled": false,
    "status": null
  },
  "billing_address_collection": null,
  "cancel_url": "redacted",
  "client_reference_id": "736316",
  "client_secret": null,
  "consent": null,
  "consent_collection": null,
  "created": 1698170692,
  "currency": "usd",
  "currency_conversion": null,
  "custom_fields": [
  ],
  "custom_text": {
    "shipping_address": null,
    "submit": null,
    "terms_of_service_acceptance": null
  },
  "customer": "redacted",
  "customer_creation": null,
  "customer_details": {
    "address": null,
    "email": "redacted@redacted.com",
    "name": null,
    "phone": null,
    "tax_exempt": "none",
    "tax_ids": null
  },
  "customer_email": null,
  "expires_at": 1698257091,
  "invoice": null,
  "invoice_creation": {
    "enabled": false,
    "invoice_data": {
      "account_tax_ids": null,
      "custom_fields": null,
      "description": null,
      "footer": null,
      "metadata": {
      },
      "rendering_options": null
    }
  },
  "livemode": true,
  "locale": null,
  "metadata": {
  },
  "mode": "payment",
  "payment_intent": "redacted",
  "payment_link": null,
  "payment_method_collection": "always",
  "payment_method_configuration_details": {
    "id": "redacted",
    "parent": "redacted"
  },
  "payment_method_options": {
  },
  "payment_method_types": [
    "card"
  ],
  "payment_status": "unpaid",
  "phone_number_collection": {
    "enabled": false
  },
  "recovered_from": null,
  "setup_intent": null,
  "shipping": null,
  "shipping_address_collection": null,
  "shipping_options": [
  ],
  "shipping_rate": null,
  "status": "open",
  "submit_type": null,
  "subscription": null,
  "success_url": "redacted",
  "total_details": {
    "amount_discount": 0,
    "amount_shipping": 0,
    "amount_tax": 0
  },
  "ui_mode": "hosted",
  "url": "checkout url"
}```
stray ivy
#

That name should come from the Product name or the Subscription name as far as I know. You don't have to redact object IDs by the way. They're not sensitive

barren oysterBOT
somber night
# stray ivy That name should come from the Product name or the Subscription name as far as I...

Just erring on the side of caution, I've accidentally leaked production keys before ๐Ÿ˜…

The issue I'm having is AFTER the payment is made, I want to get the name (of the product) of the payment that was just made. However, I do not control the POST requests, so I'm not able to get it in that way.

I've looked through a few logs, and I've found this: /v1/payment_pages/cstoken. So, I guess I can reform my question; if I have a cs_token, is there a way I can fetch the name (or) description of the product the customer has bought?

stray ivy
#

I believe so, but let me check

#

Okay, yeah. It's kind of buried though

#

You have to expand the Checkout Session's line_items.data.price.product to get the Product data. Otherwise, without expanding, you can just get the Product ID if that's all you want.