Hello,
I’m looking to integrate Stripe Subscriptions to have the feature of mulitple recurring payments via Stripe for different Stripe products.
Is this feature available or in development?
Hello,
I’m looking to integrate Stripe Subscriptions to have the feature of mulitple recurring payments via Stripe for different Stripe products.
Is this feature available or in development?
If you are looking to integrate stripe via Wix Code (this means, you will be writing code), it is possible.
The way to approach this is to read the Stripe docs, and using wix code backend code and fetch build the integration. It will look something like the send email integration.
If you are looking for built-in integration with Wix eComm, this forum is not the place to get an answer for.
Yoav, I am going to attempt this in the next couple of days. I will post questions here if I have any, if that is ok. I will review the send email integration template before I begin.
Sure, we are happy to help. Ask any question you may have.
Thank you Yoav. No, this is not for eComm.
I’d be happy to follow your progress @walkingbillboards.al
Ok, I am about to cry because this is so confusing, but I am determined to figure it out. Actually, if I want to launch my website and the Subscription Service it needs, I don’t really have a choice BUT to figure it out.
I have been studying Stripe’s documentation for the last 2 days. I have reviewed all of the SendGrid articles that you guys provided and frankly, I feel like a complete idiot, because I am definitely missing something.
I spoke with Stripe’s technical service and they said I need to import the stripe Java library, but I have no idea where to do that on our side. I’m assuming that needs to be my first step in the actual coding, correct? If so, where does it go? Is there documentation that you can refer me to that tells us how to do that?
Hi walkingbillboards.al,
We have a (non published yet) example for stripe integration - here is how it looks -
import {createToken, encodeCard} from "public/stripeAPI.js";
import {charge} from 'backend/stripeProxy';
$w.onReady(function () {
setData();
});
export function payNow(event) {
createToken(encodeCard(createCard()))
.then((token) => {
console.log("Card token: " + token);
charge(token)
.then((chargeResponse) => {
console.log("Charge ID: " + chargeResponse.id);
});
});
}
function validate() {
return true;
}
function createCard() {
return {
"name": $w("#nameOnCard").value,
"number": $w("#cardNumber").value,
"cvc": $w("#cvc").value,
"exp_year": $w("#expYear").value,
"exp_month": $w("#expMonth").value
};
}
function setData() {
$w("#nameOnCard").value = "Joe Smith";
$w("#cardNumber").value = 4242424242424242;
$w("#cvc").value = 123;
$w("#expYear").value = 2017;
$w("#expMonth").value = 12;
}
the stripeAPI.js file - in public folder
import {fetch} from 'wix-fetch';
export async function createToken(card) {
//Go to stripe.com to create a test key and replace the one in the example
const apiKey = "API_KEY";
const response = await fetch("https://api.stripe.com/v1/tokens", {
method: 'post',
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Bearer " + apiKey
},
body: card
});
if (response.status >= 200 && response.status < 300) {
const json = await response.json()
return json.id;
}
const responseText = await response.text();
console.log(responseText);
return response.status;
}
export function encodeCard(card){
let encoded = "";
for (let [k, v] of Object.entries(card)) {
encoded = encoded.concat("card[", k, "]=", encodeURI(v), "&");
}
return encoded.substr(0, encoded.length - 1);
}
and the file stripeProxy.jsw - in the backend folder
import {fetch} from 'wix-fetch';
export async function charge(token) {
const cart = getCart();
//Go to stripe.com to create a test key and replace th eone in the example
const apiKey = "API_KEY";
const response = await fetch("https://api.stripe.com/v1/charges", {
method: 'post',
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Bearer " + apiKey
},
body: encodeBody(token, cart)
});
if (response.status >= 200 && response.status < 300) {
return await response.json();
}
return await response.text();
}
function encodeBody(token, cart){
let encoded = "";
for (let [k, v] of Object.entries(cart)) {
encoded = encoded.concat(k,"=", encodeURI(v), "&");
}
encoded = encoded.concat("source=", encodeURI(token));
return encoded;
}
function getCart(){
return {
"amount": 250,
"currency": "USD",
"description": "whatever"
};
}
Dear God! You are my best friend!! I am going to go try and implement. I will post back here if I run into trouble. Thank you, thank you, thank you!!!
Ok, so if I am understanding this correctly… This code will get Checkout working and will charge the card, yes?
So, if I then need to connect to my established Subscription Plans, I would need to write it slightly differently, correct?
Probably. I do hope this gives you some head start on how to perform such an integration.
Hi @walkingbillboards.al
Did you manage to get the integration to work? I’m very curious
Cheers!
Bumping this thread. Any updates on this topic, anyone able to integrate Stripe or have a good tutorial? The above code is not working for me.
Hay all,
We understand that this type of integration is, while possible, a bit challenging. As a result, we have something in the oven - to support recurring payments via 3rd party provider.
To help us tune the product, will help us a lot if you can share your use cases - so that we can make sure those are supported.
Hi,
Im also having a site that needs a recurring payment method, but instead of stripe which is not supported in my country I am willing to use Paypal.
Hope you will create an article that shows how to go through that.
Thanks.
Hey Yoav! Thanks for the note.
I’d like to be able to implement Stripe Connect. Stripe has documentation for this, but honestly, it is so confusing for a novice coder, whose only experience with Javascript is Wix Code. If the cases could give insight on how to implement Connect, that would be great! Here are a few articles directly from Stripe.
Hi, everyone! Sorry! I have been away from the forum for a while. I was not able to successfully get the Stripe Integration to work and instead opted to go with a workaround through JotForm. I would prefer to house it on my own website with wix exclusively, so Yoav, I am interested to see what you have in the oven.
To answer your question, for my recurring payments, I need it to bill monthly and also be able to upgrade or downgrade the subscription and have that be managed by the user. Also, I need the option to change the user to a different plan automatically after a specified period of time. (In other words, the first year, the subscription rate is $xx and the second year, it goes down to only $x.) I will let some other users who have requested recurrings be supported that you are looking for information on this thread so that you can get additional input.
Hi Yoav, I have had a few clients come into the Wix Lounge asking for subscriptions for their store products. For example, there was a soap/natural products/body oil products owner who wanted to start a “monthly” product subscription. I also had one who made cookies and wanted people to be able to subscribe to “a year of treats”, so each month they would get a delivery and she wanted them to be billed at the beginning of each month.
Scenerio 1 (expiration based ob months days or years)
Classify 3 different types of members to access 3 different pages of website to pay 3 different types of prices for “x” amount of months (or days or years). 3 levels of members with 3 tier pricing with different expiration)
Scenerio 2 (expiration based on # of visits a member makes on a website)
All members pay 1 same price to access certain pages for “x” number of times. After member logs into page after “x” number of times then their card is charged automatically to renew another bundle of “x” number of visits.
Or
Same as scenerio 2 but three tier pricing for discounted “x” number of visits. (aka, upgrading or downgrading price packages)
Hi Yoav,
This is the functionality I need:
user is unable to access subscriber/member pages until recurring subscription is in place
user selects a subscription
user sees terms of subscription
user clicks to subscribe and goes through payment gateway or cart
subscription payment is confirmed by email and onscreen message
user can now access subscriber only pages
If subscription lapses/payment fails, user is automatically unable to access subscriber only pages.
user receives message/email that subscription lapsed/failed to renew.
user can manage subscription levels or cancel subscription
admin can set up subscriber only pages/content (already available - member’s area)
admin can set one or multiple subscription plans/levels
admin can select subscription period eg Week, Month, Year
Admin can set amount of subscription per period
Admin can provide discount coupons
Admin can select from various payment gateways for subscription
Admin can access report on number of subscriptions in play
Admin can access report on lapsed/failed renewals
Admin can manage members’ accounts eg upgrade, allow extension, renew, cancel, delete.
Thanks!
Kate in Sydney
Yoav (or Wix in general) – I know “something is in the oven” regarding this. However, can you give us any sort of time frame? Admittedly, I have been pulling my hair out for the past couple of weeks trying to figure out how to integrate Stripe into Wix Code. I don’t even care about recurring payments. I just straight up cannot even figure out how to process a single payment.
Is there ANYTHING that can point me in the right direction on how we can integrate Stripe into Wix Code??