标签: stripe-payments

未初始化的常量Stripe ::错误

我在使用Stripe,Rails(3.2.8)和Ruby(1.9.2)时遇到了一个未初始化的常量.

最初,我的销售模型使用以下(这有效!):

def charge_card
  begin
    save!
    charge = Stripe::Charge.create(
      amount: self.amount,
      currency: "usd",
      card: self.stripe_token,
      description: self.email,
    )
    self.finish!
  rescue Stripe::Error => e
    self.update_attributes(error: e.message)
    self.fail!
  end
end
Run Code Online (Sandbox Code Playgroud)

然后,我决定使用Stripe的一些附加信息更新该记录,因此我将其更改为以下内容:

def charge_card
  begin
    save!
    charge = Stripe::Charge.create(
      amount: self.amount,
      currency: "usd",
      card: self.stripe_token,
      description: self.email,
    )
    self.update(
      stripe_id:       charge.id,
      card_expiration: Date.new(charge.card.exp_year, Charge.card.exp_month, 1),
      fee_amount:      charge.fee
    )
    self.finish!
  rescue Stripe::Error => e
    self.update_attributes(error: e.message)
    self.fail!
  end
end
Run Code Online (Sandbox Code Playgroud)

这导致以下结果: uninitialized constant Stripe::Error

我很想得到一些关于如何正确更新记录的帮助/指导.

谢谢!

ruby-on-rails ruby-on-rails-3 stripe-payments

0
推荐指数
2
解决办法
2013
查看次数

条带C#错误处理

我设法使用Strip.net dll的一个版本来创建一个付款方法,但我有处理错误的问题.我得到了这个.

try
{
    StripeCustomer current = GetCustomer();
    // int? days = getaTraildays();
    //if (days != null)
    //{
    int chargetotal = 300; //Convert.ToInt32((3.33*Convert.ToInt32(days)*100));
    var mycharge = new StripeChargeCreateOptions();
    mycharge.AmountInCents = chargetotal;
    mycharge.Currency = "USD";
    mycharge.CustomerId = current.Id;
    string key = "sk_test_XXX";
    var chargeservice = new StripeChargeService(key);
    StripeCharge currentcharge = chargeservice.Create(mycharge);
    //}
}        
catch (StripeException)
{
    lblerror.Text = "Please check your card information and try again";
}
Run Code Online (Sandbox Code Playgroud)

它将捕获错误并让用户知道存在问题,但我是新的,以了解为什么它仍然显示错误,如果该过程工作.我知道它的问题与捕获的方式有关,但我不确定如何处理,我尝试过的所有内容都失败了.我想做的是让它重定向到另一个页面.有任何想法吗

++更新

在Olivier Jacot-Descombes的帮助下,我改变了我的代码

catch (StripeException ex) 
{ 
lblerror.Text = (ex.Message); 
}
Run Code Online (Sandbox Code Playgroud)

并且能够获得更好的结果

c# asp.net stripe-payments stripe.net

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

在没有JS的情况下执行Stripe事务以检索令牌

我试图在不使用Javascript的情况下执行带区交易。可能是cURL,但我无法使用v2 api找出标头。

<form action="" method="POST" id="payment-form">
  <span class="payment-errors"></span>

  <div class="form-row">
    <label>
      <span>Card Number</span>
      <input type="text" size="20" data-stripe="number"/>
    </label>
  </div>

  <div class="form-row">
    <label>
      <span>CVC</span>
      <input type="text" size="4" data-stripe="cvc"/>
    </label>
  </div>

  <div class="form-row">
    <label>
      <span>Expiration (MM/YYYY)</span>
      <input type="text" size="2" data-stripe="exp-month"/>
    </label>
    <span> / </span>
    <input type="text" size="4" data-stripe="exp-year"/>
  </div>

  <button type="submit">Submit Payment</button>
</form>



<?php
require '../stripe-php/init.php';

//this next line is very wrong
$post = 'client_secret=['sk_07C5ukIdqx'].'&grant_type=authorization_code&code='.$_GET['code'];
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $system['stipe']['token_url']);
curl_setopt($ch,CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch); …
Run Code Online (Sandbox Code Playgroud)

php api curl stripe-payments

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

将支付服务提供商与AWS Cognito用户集成

背景

我是一名前端开发人员,我正在寻找能够处理我的最终用户登录,他们的数据和付款的BaaS.

我正在考虑使用AWS Cognito,因为它可以卸载(间接)整个创建用户/登录/忘记密码进程,并向其他AWS服务(如S3和DynamoDB)授予细粒度访问权限(我想存储客户数据).

问题

我想向我的用户提供免费增值服务,因此我希望与Stripe或Amazon Payments等支付服务提供商集成.遗憾的是,我不明白这种集成在概念上是如何运作的,以及它将如何实际完成.

  1. 最终用户将登录我将使用Cognito的"我的网站".
  2. 最终用户将通过Stripe付款.
  3. Stripe会以某种方式知道哪些最终用户登录到Cognito,而Cognito会知道最终用户通过Stripe向我的帐户付款.
  4. 我将使用Cognito Sync将付款信息存储在他的帐户中,并授予他权限 - 例如 - 上传特定的S3存储桶.

payment-gateway amazon-web-services stripe-payments amazon-cognito

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

条纹Webhook响应

为什么我会像这样获得客户ID和发票ID cus_0000000000000和in_0000000000000?在条纹webhook响应中。我正在检查我的帐户中的事件和响应,我得到了200的响应,但是却获得了客户ID和发票ID,为什么?我正在检查发送测试webhook事件,我得到了这样的响应。

public function actionStripeHook() {


    if (Yii::app()->request->isPostRequest) {

        try {

            $postdata = file_get_contents("php://input");
            $event = json_decode($postdata);


                switch ($event->type) {

                    case 'invoice.payment_succeeded':

                        Yii::log('', 'trace', 'stripe');
                        Yii::log('==================================', 'trace', 'stripe');
                        Yii::log('==== Event (' . $event->type . ') ====', 'trace', 'stripe');
                        Yii::log('==================================', 'trace', 'stripe');
                        $customer_id = $event->data->object->customer;                            
                        $customer = Stripe_Customer::retrieve($customer_id);                            
                        $invoice = Stripe_Invoice::retrieve($event->data->object->id);
Run Code Online (Sandbox Code Playgroud)

}

我的代码有什么问题,这是我在条纹Webhook端点中的操作,我收到了事件类型invoice.payment_succeeeeeed该事件来自这种情况,但是在我的Response.s中无法正确获取客户ID和发票ID。为什么?

webhooks stripe-payments

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

列出Node.js中的所有条带费用

我们正在从Ruby迁移到NodeJS,我们本质上希望在Node中提供一个类似这样的函数:

starting_after = nil
charges = []
while true
  results = Stripe::Charge.all(limit: 100, starting_after: starting_after)
  break if results.data.length == 0
  charges = charges + results.data
  starting_after = results.data.last.id  
end
Run Code Online (Sandbox Code Playgroud)

如何在NodeJS中实现呢?

javascript node.js stripe-payments

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

在angularJS / NodeJS中使用条带支付方法Stripe.charges.create({})时出现“未捕获的TypeError:无法读取未定义的属性'create'”

您好,我是AngularJS的新手,正在从事一个我正在创建带条纹付款表格的项目。我已经创建了表单,并按照条纹网站中的描述创建了我的JS代码。我得到了卡验证的真实响应,但是付款方式在控制台“未捕获的TypeError:无法读取未定义的属性'create'”上给了我这个错误,

以下是我的HTML代码:

<div class="checkout_popup" id="checkout_popup">
    <div class="col-md-12"><h3>Form</h3></div>
    <form id="payment-form" method="post">
    <div class="col-md-12"><input type="email" id="email" placeholder="Email" /></div>
    <div class="col-md-12"><input type="text" id="card-number" data-stripe="number" value="4242424242424242" placeholder="Card Number (16 Digit)"/></div>
    <div class="col-md-12"><input type="text" id="card-cvc" placeholder="cvc" data-stripe="cvc" value="123" /></div>
    <div class="col-md-12"><input type="text" id="card-expiry-month" data-stripe="exp_month" value="12" placeholder="Month Expire" /></div>
    <div class="col-md-12"><input type="text" id="card-expiry-year" data-stripe="exp_year" value="2017" placeholder="Year Expire" /></div>
    <div class="col-md-12"><input type="button" id="pay-now" value="Pay Now" ng-click="submitstripe()" /></div>
    </form>
</div>
Run Code Online (Sandbox Code Playgroud)

这是JS代码:

.controller('UserAccountController', function($scope, $http, $state, $stateParams, $filter) {
 $scope.submitstripe = function(){
        console.log('ready stripe');


        Stripe.card.createToken({
        number: document.getElementById('card-number').value,
        cvc: document.getElementById('card-cvc').value, …
Run Code Online (Sandbox Code Playgroud)

javascript jquery node.js angularjs stripe-payments

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

Stripe不再支持使用TLS 1.0进行的API请求

我正在使用Python Stripe包.我收到了错误Stripe no longer supports API requests made with TLS 1.0.我在Mac上使用Python 2.7.我该如何解决?

# Set this to your Stripe secret key (use your test key!)  
stripe.api_key = "sk_test_VAjLc9DN9BXMS3GPvFn5W92c"   

# Get the credit card details   
token = info['stripeToken']  
amount = info['amount']   
description = info['description']  

# Create the charge on Stripe's servers - this will charge the user's card   
charge = stripe.Charge.create(
    amount=amount,
    currency="usd",
    card=token,
    description=description
)
Run Code Online (Sandbox Code Playgroud)
Traceback (most recent call last):
  File "/Users/vertace/Desktop/payableApp-Sumup/payableAppServer.py", line 23, in pay
    description=description …
Run Code Online (Sandbox Code Playgroud)

python stripe-payments

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

Axios条纹问题。“ invalid_request_error”

我不知道该怎么做!我正在尝试通过Stripe API创建客户。用他们的例子卷曲我没有问题。这是他们的例子:

curl https://api.stripe.com/v1/customers \ -u sk_test_apikey: \ -d description="Customer for zoey.brown@example.com" \ -d source=tok_visa

当我尝试使用axios执行此操作时,出现错误“ invalid_request_error”,因为它无法正确解析我的数据。这是我所拥有的:

export const registerNewUser = async (firstName, lastName, email, password) => {
  let config = {
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': `Bearer ${stripeTestApiKey}`
    }
  }
  let data = {
      email: `${email}`,
      description: `Customer account for ${email}`
  }
  await axios.post(stripeCustomerUri, data, config)
    .then(res => {
      console.log("DEBUG-axios.post--res: ", res)
    })
    .catch(err => {
      console.log(JSON.stringify(err, null, 2))
    })
}
Run Code Online (Sandbox Code Playgroud)

在我的控制台中,我看到条带没有以正确的方式接收我的数据。这是(我的有用部分)响应json:

"response": { 
  "data": { 
    "error": { 
      "type": …
Run Code Online (Sandbox Code Playgroud)

javascript stripe-payments axios

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

基本Stripe集成无法加载付款页面

我正在使用服务器快速入门示例将用户发送到Stripe进行付款

https://stripe.com/docs/payments/checkout/server

返回所需的会话ID,我将其发送到Stripe。但付款页面未加载。

我已将我的API密钥交换为XXXXX。

将PHP设置为显示所有错误,并且不存在任何错误。

三重检查我的代码是否与集成示例匹配(进行了明显的必要修改)

检查了我的Stripe帐户。

在HEAD

<script src="https://js.stripe.com/v3/"></script>
Run Code Online (Sandbox Code Playgroud)

在PHP中

require_once('stripe-php-6.31.5/init.php');

\Stripe\Stripe::setApiKey("pk_test_XXXXXXXXXXXXXXXXXXXXXXX");

$object = \Stripe\Checkout\Session::create([
        'success_url' => 'https://www.example.com/success',
        'cancel_url' => 'https://www.example.com/cancel',
        'payment_method_types' => ['card'],
        'line_items' => [[
        'amount' => 500,
        'currency' => 'gbp',
        'name' => 'T-shirt',
        'description' => 'Comfortable cotton t-shirt',
        'images' => ['https://www.example.com/t-shirt.png'],
        'quantity' => 1,
    ]]
]);

$session_id = $object->id;

if ($session_id) {

    echo "<script>
          var stripe = Stripe('pk_test_XXXXXXXXXXXXXXXXXXXXXXX');
          stripe.redirectToCheckout({
          sessionId: '{{" . $session_id . "}}'
          }).then(function (result) {
          });
          </script>";

} else {

    echo 'No Session …
Run Code Online (Sandbox Code Playgroud)

php stripe-payments

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