小编Zoe*_*kov的帖子

我需要监听哪些 webhook 事件才能订阅

我试图理解条纹事件,但很困惑/不确定我是否理解正确。我的问题用斜体字。我的客户周期如下。 图表

#1

使用checkout.session.completed事件来确定他们是否已订阅。然后使用subscriptionid 获取有关订阅的信息。这是使用正确的事件吗?

#2a 和 #2b

我不知道这里使用什么事件。我收到了很多事件,例如、charge.succeeded、等。我用哪个来确定客户是否已付款或未付款以及延长或结束他们的订阅?payment_intent.succeededinvoice.finalizedinvoice.paid

#3a 和 #3b

假设我使用invoice.payment_succeeded#3a。我使用哪些事件来确定发票信息?

#4a 和 #4b

这是我根据从 Stripe 获得的信息在我的网站上所做的事情。如何将 Stripe 的时区转换为悉尼/澳大利亚时区。

php webhooks stripe-payments

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

如果用户输入多行/空格,如何计算单词数?

我有一个char数组,其中包含用户输入的内容.我怎么算数字呢?允许用户做一些疯狂的事情:

hello this
               is a test
   how are
you today?
Run Code Online (Sandbox Code Playgroud)

所以这里的单词数量应为9,但我的程序告诉我23.为什么这不起作用?它计算空间,但我考虑到了这一点sentence_entered[i + 1] != ' '

我的代码:

int i = 0;    
while (sentence_entered[i] != '\0') {

        if (
            (sentence_entered[i] == ' ' ||
            sentence_entered[i] == '\n') &&
            (sentence_entered[i + 1] != ' ' ||
            sentence_entered[i + 1] != '\n')
           ) {
            words += 1;
    }
i++
}
Run Code Online (Sandbox Code Playgroud)

c arrays if-statement while-loop

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

如何检查char*是否为空?

如何检查是否char *name为空?

#include <stdio.h>
#include <string.h>

void store_stuff(char **name, int *age);
int main(void) {

    char *name;
    int age;

    store_stuff(&name, &age);

    printf("Name: %s\n", name);
    printf("Age: %d\n", age);

}

void store_stuff(char **name, int *age) {

    *age = 31;

    if (name == NULL) { // how can I check here if char name is empty?
        *name = "ERROR";
    }

}
Run Code Online (Sandbox Code Playgroud)

c string pointers char

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