从 Stripe Webhook 更新 Parse.com 用户 [英] Update Parse.com User from Stripe Webhook

查看:20
本文介绍了从 Stripe Webhook 更新 Parse.com 用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我看到这里有几个 Parse/Stripe 问题,但没有一个对我有任何帮助.

Firstly I see there are several Parse / Stripe questions on here however none are of any help to me.

我有一个同时具有免费和付费功能的移动应用程序.变量存储在 Parse.com 的 User 类中,并在运行函数时检查其权限.我想设置一个帐户门户(与我的应用程序分开),因此当用户希望注册时,他们会被发送到他们的浏览器,并且可以通过 SSL 等注册计划.

I have a mobile application that has both free and paid features. A variable is stored on the User class in Parse.com and it is checked for permissions when running a function. I would like to setup an account portal (separate to my app) so when users wish to signup they are sent to their browser and can signup to a plan over SSL etc etc.

对于帐户门户,我有一个带有 Stripe 插件的 Wordpress 站点,该插件将为我进行会计、发票和表单创建工作.

For the account portal i'm having a Wordpress site with a Stripe plugin that will do my accounting, invoicing and form creation work for me.

在 Wordpress 网站上注册后,我想在 Parse.com 上接收 webhook 并运行一个函数来更新 User 类.理想情况下,这将是一个包罗万象的功能,它将根据用户的帐户状态将用户更改为多种状态(即他们停止付款并且计划将暂停).

Following signup on the Wordpress site I would like to receive the webhook on Parse.com and run a function to update User class. Ideally this will be a catch all function that will change the user to a number of states depending on their account status (i.e they stop paying and the plan will be on hold).

我的问题有两个:

  1. 我需要在 Stripe webhook 设置中放入哪些详细信息(URL 等)才能将所有事件发送到我的 Parse.com 云代码?

  1. What details (URL etc) do I need to place in my Stripe webhook settings to send all events to my Parse.com cloud code?

在收到来自 Parse.com 的网络钩子后,我如何在云代码上接收/运行我的函数?

How do I receive / run my function on the Cloud code upon receipt of a webhook from Parse.com?

如果您对我的应用程序的工作方式有任何建议,我愿意接受批评并在我的实施中保持灵活.

I am open to criticism and remain flexible in my implementation if you have suggestions on how my app should work.

非常感谢.

推荐答案

经过一些实验确定:

  1. 使用 URL 在 Stripe Accounts 区域创建一个 webhook:https://**APPLICATION_ID**:javascript-key=**JAVASCRIPT_KEY**@api.parse.com/1/functions/update_user

在您的云代码中,使用与 URL 的最后部分相同的函数名称.在我的情况下 update_user.

In your cloud code use the same function name as the final part of your URL. in my case update_user.

创建 webhook 的测试版本并将其放入您的云代码中进行测试:

Create a test version of the webhook and place this in your cloud code for testing :

Parse.Cloud.define("update_user", function(request, response) {response.success('** WEBHOOK WORKING **' + request);});

在条带仪表板中运行测试时,您应该看到:

When running the test in the stripe dashboard you should see:

希望这对某人有所帮助 - 非常感谢任何人对我的实现或在我的 User 类更新上运行的光滑函数的任何输入.

Hope that this helps someone - Would be grateful of any input anyone has as to my implementation or a slick function to run on my User class update.

这篇关于从 Stripe Webhook 更新 Parse.com 用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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