[英]Cloudflare with Stripe webhook returns HTTP 301 error
[英]Stripe connection error Cloudflare worker
我收到“錯誤:我們與 Stripe 的連接出錯”。 在 cloudflare 工作器中的 paymentIntents.create 處。
這是代碼:
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
/**
* Respond with hello worker text
* @param {Request} request
*/
async function handleRequest(request) {
const stripe = require('stripe')('Stripkey');
const paymentIntent = await stripe.paymentIntents.create({
amount: 1000,
currency: 'cad',
payment_method_types: ['card'],
receipt_email: 'jenny.rosen@example.com',
});
return new Response('Hello worker!', {
headers: { 'content-type': 'text/plain' },
})
Cloudflare 工作人員不完全支持 Node.js ,您看到的錯誤是由於 Stripe 的 Node 庫依賴於特定於 Node 的 API 才能工作。 Stripe 正在進行修復工作,一旦發布該修復程序,它應該會按預期開始工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.