Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entering Password Automatically for Stripe From Bash Script

I am using Stripe's Curl API to create subscriptions.

My bash script looks like this

#!/bin/bash

set pass MyPasword123
curl https://api.stripe.com/v1/customers -u sk_test_BQokikJOvBiI2HlWgH4olfQ2 -d card[number]=4242424242424242 -d card[exp_month]=12 -d card[exp_year]=2016 -d card[cvc]=123 -d plan=EarlyAdopter -d [email protected]
expect -re "Enter host password for user 'sk_test_BQokikJOvBiI2HlWgH4olfQ2:':"
send "${pass}\r"

This does now work.

How do I enter automatically a password for the Stripe Curl API?

Thanks...

like image 402
user27478 Avatar asked Mar 16 '23 23:03

user27478


1 Answers

The issue here is that you are only passing the API key but you're missing the : at the end. This is mentioned in the documentation about the Authentication. It should be like this:

curl https://api.stripe.com/v1/customers    \
   -u sk_test_XXX:                          \
   -d card[number]=4242424242424242         \
   -d card[exp_month]=12                    \
   -d card[exp_year]=2016                   \
   -d card[cvc]=123                         \
   -d plan=EarlyAdopter                     \
   -d [email protected]
like image 134
koopajah Avatar answered Apr 27 '23 21:04

koopajah