将服务器侧邮政编码/邮政编码传递给 Stripe 结账 [英] Passing sever side zip/postcode to Stripe checkout

查看:30
本文介绍了将服务器侧邮政编码/邮政编码传递给 Stripe 结账的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置 Stripe 结账,以便我可以将我的服务器端客户邮政编码/邮政编码传递给 Stripe 结账.看起来应该很简单,但我无法让它工作!

I am trying set up Stripe checkout so I can pass my server side customer zip/postcode to the Stripe checkout. It seems like it should be very simple but I cannot get it to work!

最简单的,我使用的代码是:

At it's simplest, the code I am using is:

<form action="charge.php" method="POST">
<script
  src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button"
  data-key="pk_test_redacted"
  data-amount="2000"
  data-name="Demo Site"
  data-description="2 widgets (£20.00)"
  data-currency="gbp"
  data-address_zip="NG15 6UR">
</script>
</form> 

交易工作正常,但没有通过邮政编码,因此可以进行 AVS 检查.

the transaction works fine but it does not pass the zip/postcode so that it can be AVS checked.

我做错了什么?

很明显,您无法使用 checkout.js 传递地址信息 - 您只能在客户使用信用卡详细信息时获取要求提供地址的表单

So apparently you cannot pass address information using checkout.js - you can only get the form to require the address from the customer when they put their card details in using

data-address="true2"

据我所知,这意味着我可以让客户在我已经拥有他们的地址详细信息时添加他们的地址详细信息来麻烦客户!

As far as I can tell, this means I can either hassle the customer by getting them to add their address details when I already have them!

或者我必须使用stripe.js,这意味着我已经构建了自己的表单,让它看起来很漂亮,验证它等等.这不是一件大事,但是,当那里有一个表单可以完成我需要的一切但接受地址表单时表单创建时传递的字段,有点烦人:-(

or I have to use stripe.js which means I have build my own form, make it look pretty, validate it etc. Not a massive thing but, when there is a form there that does everything I need but accept address form fields passed at form creation, it is a little annoying :-(

如果有人知道,我很乐意听到它,但此信息来自#stripe irc 频道,所以我认为它可能是正确的.

If anyone knows otherwise I would love to hear it but this info came from the #stripe irc channel so I think it is probably correct.

推荐答案

正如编辑中所说,我确实必须使用 stripe.js 并制作我自己的表单.可惜这个小小的遗漏意味着相当多的额外工作 - 但仍然比 Paypal 混乱的 API 和文档要好得多!也更便宜.

As said in the Edit, I did have to use stripe.js and make my own form. Shame this small omission means quite a bit of extra work - but still much better than Paypal's mess of APIs and documentation! Cheaper too.

这篇关于将服务器侧邮政编码/邮政编码传递给 Stripe 结账的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆