next stripe
1.0.0
سير عمل SPORTION من جانب الخادم في NEXT.JS
️ يرجى ملاحظة: هذه المكتبة حاليًا في بيتا ويجب استخدامها في الإنتاج بحذر!
yarn add next-stripe@beta
قم بإنشاء [...nextstripe].js Catch-Coll في دليل pages/api/stripe .
️ يرجى ملاحظة: يوصى باستخدام مفتاح مقيد مع وصول محدود API مع هذه المكتبة. يمكن إنشاء هذه المفاتيح وتكوينها مع الوصول المطلوب في لوحة معلومات الشريط.
import NextStripe from 'next-stripe'
export default NextStripe ( {
stripe_key : process . env . STRIPE_RESTRICTED_KEY
} ) next-stripe/client Exports Helper وظائف للاتصال بطرق API Next.js.
مستندات API Stripe
import { createCheckoutSession } from 'next-stripe/client'
const session = await createCheckoutSession ( {
success_url : window . location . href ,
cancel_url : window . location . href ,
line_items : [ { price : 'price_id' , quantity : 1 } ] ,
payment_method_types : [ 'card' ] ,
mode : 'payment'
} )مستندات API Stripe
import { createPaymentIntent } from 'next-stripe/client'
const paymentIntent = await createPaymentIntent ( {
amount : 1000 ,
currency : 'usd'
} ) مستندات API Stripe
import { confirmPaymentIntent } from 'next-stripe/client'
const paymentIntent = await confirmPaymentIntent ( 'pi_id' , {
payment_method : 'pm_id'
} ) مستندات API Stripe
import { retrievePaymentIntent } from 'next-stripe/client'
const paymentIntent = await retrievePaymentIntent ( 'pi_id' ) مستندات API Stripe
import { updatePaymentIntent } from 'next-stripe/client'
const paymentIntent = await updatePaymentIntent ( 'pi_id' , {
amount : 1000 ,
currency : 'usd'
} )مستندات API Stripe
import { createBillingPortalSession } from 'next-stripe/client'
const session = await createBillingPortalSession ( {
customer : 'cus_id' ,
return_url : window . location . href
} )