Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON payload issue #44

Closed
niolap opened this issue Sep 1, 2022 · 1 comment
Closed

JSON payload issue #44

niolap opened this issue Sep 1, 2022 · 1 comment

Comments

@niolap
Copy link

niolap commented Sep 1, 2022

Hi there :)

I would like to send a payload as JSON to Chargebee API but it only works in URL encoded format, not in JSON format.
I need to send JSON from the requests Python package without the Chargebee wrapper.
Any idea?

As URL encoded: does work

$ curl  https://***********-test.chargebee.com/api/v2/payment_sources/create_card \
>      -u **************************************:\
>      -d customer_id="cbdemo_douglas" \
>      -d card[number]="378282246310005" \
>      -d card[cvv]="100" \
>      -d card[expiry_year]=2022 \
>      -d card[expiry_month]=12
{
    "payment_source": {
        "id": "pm_BTcLSfTGD1TtShje",
        "updated_at": 1662057402,
        "resource_version": 1662057402861,
        ...
        }
    }
}

As JSON: does not work

$ curl https://***********-test.chargebee.com/api/v2/payment_sources/create_card \
>      -u **************************************:\
>      -H 'content-type: application/json' \
>      -H 'accept: application/json' \
>      -d '{
>       "customer_id":"cbdemo_douglas",
>       "card":{
>         "number":"378282246310005",
>         "cvv":"100",
>         "expiry_year":"2022",
>         "expiry_month":"12"
>       }
>     }'
{"message":"customer_id : cannot be blank","type":"invalid_request","api_error_code":"invalid_request","param":"customer_id","error_code":"param_required","error_msg":"cannot be blank","error_param":"customer_id","http_status_code":400}
@niolap
Copy link
Author

niolap commented Sep 1, 2022

re-opened in the correct repo chargebee/chargebee-python#54

@niolap niolap closed this as completed Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant