标签: stripe-payments

如何更新 STRIPE CHECKOUT SESSION 属性 RAILS

在 Rails 5 中,我在订单控制器的 show 操作中创建了一个条带会话。我还有一个更新操作,用于处理用户是否为该订单选择送货或提货。在更新方法中,我尝试通过添加shipping_address_collection属性来更新stripe会话,以便stripe结账页面显示送货地址区域。我设法正确修改条带会话对象,但没有保存它。我有一个 :

NoMethodError (undefined method `save' for #<Stripe::Checkout::Session:0x00007fb60fe5f138>
Run Code Online (Sandbox Code Playgroud)

订单控制器:

def show
 @session = Stripe::Checkout::Session.create(
      payment_method_types: ['card'],

      customer: customer.id,

      line_items: line_items_order,

      success_url: order_messages_url(@order),
      cancel_url:  order_failure_message_url(@order)
      )

       @user.stripe_id = customer.id
       @user.save


   @order.checkout_session_id = @session.id
   @order.save
end

def update
 @order = Order.find(params[:id])
 @session = Stripe::Checkout::Session.retrieve("#{@order.checkout_session_id}")
 
    if @order.collect_address == nil && @order.shipping_zone != nil

    allowed_countries_item = {:allowed_countries => ['GB', 'BE', 'CZ', 'FR', 'DK', 'DE', 'EE', 'IE', 'HR', 'IT', 'CY', 'LV', 'LT', 'LU', 'HU', 'MT', 'NL', 'AT', 'PL', 'RO', 'SI', …
Run Code Online (Sandbox Code Playgroud)

session attributes ruby-on-rails checkout stripe-payments

1
推荐指数
1
解决办法
1644
查看次数

如何在 ANDROID (JAVA) 中不使用 CardInputWidget 的情况下设置条带的借记卡或信用卡详细信息

我想使用从用户那里获得的卡详细信息作为ConfirmPaymentIntentParams 的参数。不使用 CardInputWidget

txt_pay.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.e("PAY 01 ", "paymentIntentClientSecret " + paymentIntentClientSecret);
            CardInputWidget cardInputWidget = findViewById(R.id.cardInputWidget);
            PaymentMethodCreateParams params = cardInputWidget.getPaymentMethodCreateParams();
            if (params != null) {
                ConfirmPaymentIntentParams confirmParams = ConfirmPaymentIntentParams.createWithPaymentMethodCreateParams(params, paymentIntentClientSecret);
                stripe.confirmPayment(this, confirmParams);
                
            } catch (JSONException e) {
                e.printStackTrace();
                Log.e("PAY 02 ", "exception " + e.getMessage());
            }
        }
    });
Run Code Online (Sandbox Code Playgroud)

java android strip stripe-payments

1
推荐指数
1
解决办法
1060
查看次数

如何调用 Google Cloud Functions 中的 Express 函数?

这是我的快速端点,它是通过Stripe 的 webhook调用的:

\n
const functions = require(\'firebase-functions\');\nconst bodyParser = require(\'body-parser\')\nconst app = require(\'express\')();\nconst stripe = require(\'stripe\')(functions.config().stripe.test.secret);\nconst endpointSecret = functions.config().stripe.test.webhookkey;\n\napp.post(\'/stripe_webhook\', bodyParser.raw({type: \'application/json\'}), async (request, response) => {\n    const event = request.body;\n    // Only verify the event if you have an endpoint secret defined.\n    // Otherwise use the basic event deserialized with JSON.parse\n    if (endpointSecret) {\n    // Get the signature sent by Stripe\n    const signature = request.headers[\'stripe-signature\'];\n    try {\n      const eventConstruct = stripe.webhooks.constructEvent(\n        request.body,\n        signature,\n        endpointSecret\n      );\n    } catch (err) …
Run Code Online (Sandbox Code Playgroud)

node.js express stripe-payments firebase google-cloud-functions

1
推荐指数
1
解决办法
2972
查看次数

使用 ngx-stripe 11.0.0 进行表单验证

阅读 ngx-stripe API,我找不到在启用“支付”按钮之前验证条带元素的方法(例如,信用卡信息完整)。有人可以提供示例代码片段吗?

谢谢。

stripe-payments angular

1
推荐指数
1
解决办法
947
查看次数

Stripe 无法自动填写客户电子邮件地址以发送收据

我有一个条带结账已启动并正在运行(在测试模式下),并且测试卡运行良好。

现在我不明白为什么成功后它不通过电子邮件发送收据。

我在文档中看到我们需要 1) 允许在仪表板中自动发送电子邮件(已完成)和 2) 在函数中指定客户的电子邮件地址checkout.sessions.create

目前,stripe 不会发送电子邮件,因为我没有在customer_email字段中指定电子邮件地址checkout.sessions.create

我不明白的是为什么 stripe 不会自动填写地址并将收据发送给它,因为 stripe checkout 实际上是在“结账”页面上收集电子邮件,如果这有意义的话......

感谢您的帮助。

javascript node.js stripe-payments reactjs

1
推荐指数
1
解决办法
726
查看次数

在 Firebase 9 上的 Https Callable 函数中设置位置(条带客户门户)

我正在尝试为用户设置一个按钮来管理他的 Stripe 客户门户及其 Firebase 集成的订阅。

问题,该文档对旧版本的 Firebase (8) 有效,而我正在使用新版本 Firebase 9。

我们在客户端,这就是 React.js。

这是他们调用该函数的js代码(您可以在这里看到完整的代码:https://github.com/stripe-samples/firebase-subscription- payments/blob/master/public/ javascript/app.js):

const functionLocation = 'us-east1';
    
const functionRef = firebase
      .app()
      .functions(functionLocation)
      .httpsCallable('ext-firestore-stripe-subscriptions-createPortalLink');
    const { data } = await functionRef({ returnUrl: window.location.origin });
    window.location.assign(data.url);
  });
Run Code Online (Sandbox Code Playgroud)

对于 Firebase 9,它应该是这样的:

const functions = getFunctions(firebaseApp)

export async function goToBillingPortal() {
       const functionRef = httpsCallable(functions, 'ext-firestore-stripe-subscriptions-createPortalLink');
    
       const { data } = await functionRef({ returnUrl: window.location.origin });
       window.location.assign(data.url);
 }
Run Code Online (Sandbox Code Playgroud)

控制台显示3个错误:

Access to fetch at 'https://us-central1-xxxxxxxxd76.cloudfunctions.net/ext-firestore-stripe-subscriptions-createPortalLink' from origin 'http://localhost:3000' has been …
Run Code Online (Sandbox Code Playgroud)

javascript stripe-payments firebase google-cloud-platform google-cloud-functions

1
推荐指数
1
解决办法
1003
查看次数

如何在 stripe 或其他替代方案中创建付款意图等于 0 美元的订阅?

我正在使用 Stripe 元素创建订阅,一切都很好...除非数量付款意图为 0 美元

来自 Stripe PaymentIntent 文档:

The minimum amount is $0.50 US or equivalent in charge currency.
Run Code Online (Sandbox Code Playgroud)

这里我有使用 stripe 元素创建支付意图的方法

# Here I created an object of type subscription incompletely (@subscription)
# In such a way that the user can enter their credit card and with the help of 
# @subscriptions confirm if everything is fine
def checkout
    @subscription = Stripe::Subscription.create(
      customer: current_user.stripe_customer_id, # stripe customer_id for suscription 
      items: [{
        price: params[:price] # attached price of suscription …
Run Code Online (Sandbox Code Playgroud)

javascript ruby ruby-on-rails stripe-payments

1
推荐指数
1
解决办法
2735
查看次数

在下一个自然结算日期之后锚定 Stripe 订阅

我正在为用户开发 Stripe 集成,并为 Stripe 上的年度订阅计划制定一些非常具体的规则:

  1. 如果用户在2022年1月1日至2022年9月30日期间开始订阅,则将立即向其收取全额费用,并于下一个2023年1月1日收取费用 - 从那时起,费用将按年收取
  2. 如果用户在2022年10月1日至2022年12月31日之间开始订阅,将立即收取全额费用,并于2024年1月1日再次收取费用 - 此后将按年收取费用

我的直接猜测是,案例#1 应该可以通过回溯、锚定、不按比例分配和/或试用期的组合来实现,尽管我还没有测试具体细节。

当下一次收费的时间超过 12 个月时,我该如何实施案例#2?据我所知,Stripe 不允许锚定日期比下一个自然计费日期(按年订阅为 12 个月)更远。Trial_end 也不可能晚于锚定日期。

我在后端使用 Laravel Cashier/PHP,但我怀疑它是开箱即用的,所以我只是在寻找用于以任何语言创建订阅的 API 选项。

stripe-payments

1
推荐指数
1
解决办法
2229
查看次数

Stripe PaymentElement 的集成。警告 不支持的属性更改:options.clientSecret 不是可变属性?

我有 PaymentMethodPage,如下所示:

import React, { FC, useState } from 'react';
import { Elements } from '@stripe/react-stripe-js';
import { loadStripe } from '@stripe/stripe-js';
import {
  getClientSecret,
} from '../../api/PaymentCalls/PaymentCalls';
import PaymentMethodSetupForm from './PaymentMethodSetupForm/PaymentMethodSetupForm';
import AddPaymentMethodContainer from './AddPaymentMethodContainer/AddPaymentMethodContainer';
import {
  ClientSecretResponse,
} from '../../interfaces/paymentMethod.interface';


const stripePromise = loadStripe(
  process.env.REACT_APP_STRIPE_PUBLIC_KEY as string
);

const PaymentMethodPage: FC = () => {
  const [enableAddPaymentMethod, setEnableAddPaymentMethod] =
    useState<boolean>(false);

  const {
    data: clientSecretKeyData,
  }: UseQueryResult<ClientSecretResponse, ExtendedError> = useQuery<
    ClientSecretResponse,
    ExtendedError
  >('getClientSecret', getClientSecret, {
    retry: false,
    refetchOnWindowFocus: false, …
Run Code Online (Sandbox Code Playgroud)

javascript stripe-payments typescript reactjs

1
推荐指数
1
解决办法
3779
查看次数

我收到 Stripe 签名错误:#&lt;Stripe::SignatureVerificationError: Nosignatures found matches the Expected Signature for Payload&gt;

我目前正在处理我的 Webhooks,但我的 Webhooks 控制器中出现错误。

这是错误:

#<Stripe::SignatureVerificationError: No signatures found matching the expected signature for payload>
No template found for WebhooksController#create, rendering head :no_content
Completed 204 No Content in 1ms (Allocations: 594)
Run Code Online (Sandbox Code Playgroud)

经过一段时间尝试调试这个问题后,我发现它来自这些行,因为我在控制台中看到的最后一个代码是错误和“签名错误”...

rescue Stripe::SignatureVerificationError => e
      # Invalid signature
      puts "Signature error"
      p e
      return
    end
Run Code Online (Sandbox Code Playgroud)

这是控制器:

class WebhooksController < ApplicationController
  skip_before_action :authenticate_user!
  skip_before_action :verify_authenticity_token

  def create
    payload = request.body.read
    sig_header = request.env['HTTP_STRIPE_SIGNATURE']
    event = nil

    begin
      event = Stripe::Webhook.construct_event(
        payload, sig_header, Rails.application.credentials[:stripe][:webhook]
      )
    rescue JSON::ParserError => e
      status 400 …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails webhooks stripe-payments

1
推荐指数
1
解决办法
1251
查看次数