【发布时间】:2021-12-21 13:03:30
【问题描述】:
我收到“错误:我们与 Stripe 的连接发生错误。”在 cloudflare worker 中的 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' },
})
【问题讨论】:
标签: node.js stripe-payments cloudflare-workers