Koristio sam Inchoo ekstenziju za povezivanje Magenta i Stripe-a. Inchoo komponenta je jednostavna i bazirana je na https://github.com/stripe/stripe-php. Kada testiram extenzij, ona radi bas kako treba.
Ali potreban mi je Stripe connect, zbog 'application_fee' odnosno provizije i tu nastaje problem.
Prema tutorialu stripe.com/docs/connect/oauth koristim https://gist.github.com/afeng/3507366
i dalje sve radi lepo.
Prema stripe.com/docs/connect/collecting-fees imamo sledeci kod :
// Get the credit card details submitted by the form
$token = $_POST['stripeToken'];
// Create the charge on Stripe's servers - this will charge the user's card
$charge = Stripe_Charge::create(array(
"amount" => 1000, // amount in cents
"currency" => "usd",
"card" => $token,
"description" => "[email protected]"),
"application_fee" => 123 // amount in cents
),
ACCESS_TOKEN // user's access token from the Stripe Connect flow
);
Ali ACCESS_TOKEN je problem,zato sto kad koristim onaj koji sam dobio u prethodnom koraku 'stripe.com/docs/connect/oauth'
dobijem gresku:
OAuth based requests must use card tokens from Stripe.js, but card details were directly provided.
Zasto i gde moram da koristim Stripe.js? Sve radi savrseno sa ovom bibliotekom do 'ACCESS_TOKEN'-a // user's access token from the Stripe Connect flow
Vec imam ACCESS_TOKEN
iz (stripe.com/docs/connect/oauth)
{
"token_type": "bearer",
"stripe_publishable_key": PUBLISHABLE_KEY,
"scope": "read_write",
"livemode": "false",
"stripe_user_id": USER_ID,
"refresh_token": REFRESH_TOKEN,
"access_token": ACCESS_TOKEN
}
Ovaj problem nije do magenta, vec negde gresim sa Stripe-om (i PHP-om).
Ako vec u ovom trenutku mora da se stavi Stripe.js (pise da mora, iako sve radi i bez njega do ovog trenutka), sta da radim sa njim???
Hvala
