Skip to content

SyntaxError: "[object Object]" is not valid JSON #27

@emmathedeveloper2

Description

@emmathedeveloper2

I keep getting this error whenever I tried to use the initialize transaction or create transfer recipient methods

Code

        const paystack = new Paystack(c.env.PAYSTACK_API_KEY) 

        const paymentIntent = await paystack.transaction.initialize({
            amount: String(total * 100),
            email: c.get('user').email,
            currency: 'NGN',
            metadata: {
                customerId: c.get('user').id,
                storeId: c.get('store').id,
                items: foundItems
            },
        })

Error

SyntaxError: "[object Object]" is not valid JSON
    at [object Object]
    at null.<anonymous> (file:///C:/Users/DELL/Desktop/PROJECTS/wallet/backend/node_modules/paystack-sdk/dist/paystack.js:41:81)
    at async Axios.request (file:///C:/Users/DELL/Desktop/PROJECTS/wallet/backend/node_modules/axios/lib/core/Axios.js:40:14)
    at async Transaction2.initialize (file:///C:/Users/DELL/Desktop/PROJECTS/wallet/backend/node_modules/paystack-sdk/dist/transaction/transaction.js:18:16)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions