Using Datatables with a Stripe response not working

Using Datatables with a Stripe response not working

rminterrminter Posts: 6Questions: 2Answers: 0

I am trying to return a Stripe response of charges for a customer into Datatables and for some reason it is not working. I have a Datatables debug page located at https://debug.datatables.net/itepiw. I am using the column.data function and the Stripe response has nested fields, so I am not sure that I have it setup just right. Here is my javascript point for the columns:
columns: [
{ data: ["amount"], title: 'Amount' },
{ data: ["created"], title: 'Date' },
{ data: ["paid"], title: 'Paid' },
{ data: ["source.brand"], title: 'Card' },
{ data: ["source.last4"], title: 'Last 4' },
{ data: ["status"], title: 'Status' }
],
Thank you in advance for any input on this.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,352Questions: 1Answers: 10,443 Site admin

    columns.data doesn't take an array, so that's not likely to be correct ('m not actually sure what DataTables will do with that!).

    Can you show me what the JSON is that you are attempting to use please.

    Allan

  • rminterrminter Posts: 6Questions: 2Answers: 0
    edited October 2016
    {
        "object": "list",
        "data": [
            {
                "id": "ch_18utQnBcugPtL5pRIWyxrvkp",
                "object": "charge",
                "amount": 8500,
                "amount_refunded": 0,
                "application_fee": null,
                "balance_transaction": "txn_18utQnBcugPtL5pRcgyBQ4d1",
                "captured": true,
                "created": 1474159517,
                "currency": "usd",
                "customer": "cus_6M3Z4JyvoqmoXM",
                "description": null,
                "destination": null,
                "dispute": null,
                "failure_code": null,
                "failure_message": null,
                "fraud_details": [
    
                ],
                "invoice": "in_18usUeBcugPtL5pRDXQzn67C",
                "livemode": false,
                "metadata": [
    
                ],
                "order": null,
                "paid": true,
                "receipt_email": null,
                "receipt_number": null,
                "refunded": false,
                "refunds": {
                    "object": "list",
                    "data": [
    
                    ],
                    "has_more": false,
                    "total_count": 0,
                    "url": "\/v1\/charges\/ch_18utQnBcugPtL5pRIWyxrvkp\/refunds"
                },
                "shipping": null,
                "source": {
                    "id": "card_17feuyBcugPtL5pR8LaLfYRf",
                    "object": "card",
                    "address_city": null,
                    "address_country": null,
                    "address_line1": null,
                    "address_line1_check": null,
                    "address_line2": null,
                    "address_state": null,
                    "address_zip": null,
                    "address_zip_check": null,
                    "brand": "Visa",
                    "country": "US",
                    "customer": "cus_6M3Z4JyvoqmoXM",
                    "cvc_check": null,
                    "dynamic_last4": null,
                    "exp_month": 2,
                    "exp_year": 2018,
                    "fingerprint": "GTh0sZ7C8Cfdb6wm",
                    "funding": "credit",
                    "last4": "4242",
                    "metadata": [
    
                    ],
                    "name": null,
                    "tokenization_method": null
                },
                "source_transfer": null,
                "statement_descriptor": null,
                "status": "succeeded"
            }
    

    Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

  • allanallan Posts: 63,352Questions: 1Answers: 10,443 Site admin
    Answer ✓

    Try using just data: "amount", etc.

    Allan

This discussion has been closed.