Question for CBsubs trigger when offline

4 years 1 month ago #316774 by activha
Hello

We make an extensive use of the trigger OnCpayAfterPaymentStatusUpdatEvent together with Stripe gateway.

Lately we had several downtime on the website, either by overload or by putting the website offline for a short period of time. During this downtime, some Stripe webhooks came back for recurring payments for some customers and the trigger was not activated then all code auto actions depending on this trigger did not start.

Is it a normal behavior ? is there anything that we could do to avoid such behaviors in the future ?

Thanks
Jean

Please Log in to join the conversation.

4 years 1 month ago #316776 by krileon
Replied by krileon on topic Question for CBsubs trigger when offline
If your site is offline then CBSubs can't be reached so yes that's normal or do you mean Stripe sent a retry later once your site was back online and it didn't renew the subscription?


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

4 years 1 month ago #316778 by activha
Replied by activha on topic Question for CBsubs trigger when offline
What it looks like is that Stripe sent retries later and the subscriptions are correctly renewed but the auto actions depending on the trigger are not launched.

Is this possible ?

Please Log in to join the conversation.

4 years 1 month ago #316780 by krileon
Replied by krileon on topic Question for CBsubs trigger when offline
Looks like the trigger you're using has a typo in it unless the typo is just in your post. The trigger is as follows.

onCPayAfterPaymentStatusUpdateEvent

It should be firing fine assuming a payment was logged.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

4 years 1 month ago #316783 by activha
Replied by activha on topic Question for CBsubs trigger when offline
Yes the typo was only in the post.

I have the following conditions :
user Automatic
[var2_payment_status] is REGEX /Completed|Processed/
[var2_gateway_account] is REGEX /1|2|5|12/

Output : display silent

PHP code as follows
$date = cbFormatDate( $variables['var2']->time_initiated, 1, false );

function extract_basket_item($item)
{
    return $item->renderColumn();
}


$payment_basket = array (
    'date' => $variables['var2']->date,
    'user_id' => $variables['var2']->user_id,
    'txn_type' => $variables['var2']->txn_type,
    'txn_id' => $variables['var2']->txn_id,
    'payment_type' => $variables['var2']->payment_type,
    'address_street' => $variables['var2']->address_street,
    'address_city' => $variables['var2']->address_city,
    'address_state' => $variables['var2']->address_state,
    'address_zip' => $variables['var2']->address_zip,
    'address_country' => $variables['var2']->address_country,
    'payer_business_name' => $variables['var2']->payer_business_name,
    'first_name' => $variables['var2']->first_name,
    'last_name' => $variables['var2']->last_name,
    'payer_email' => $variables['var2']->payer_email,
    'contact_phone' => $variables['var2']->contact_phone,
    'vat_number' => $variables['var2']->vat_number,
    'item_name' => $variables['var2']->item_name,
    'item_number' => $variables['var2']->item_number,
    'quantity' => $variables['var2']->quantity,
    'custom' => $variables['var2']->custom,
    'invoice' => $variables['var2']->invoice,
    'tax' => $variables['var2']->tax,
    'payment_date' => $variables['var2']->payment_date,
    'shipping' => $variables['var2']->shipping,
    'mc_currency' => $variables['var2']->mc_currency,
    'mc_fee' => $variables['var2']->mc_fee,
    'mc_gross' => $variables['var2']->mc_gross,
    'mc_handling' => $variables['var2']->mc_handling,
    'mc_shipping' => $variables['var2']->mc_shipping,
    'payment_fee' => $variables['var2']->payment_fee,
    'payment_gross' => $variables['var2']->payment_gross,
    'mc_amount3' => $variables['var2']->mc_amount3,
    'basket_items' => $variables['var2']->loadPaymentItems()
);

$context_options = array (
    'http' => array (
        'method' => 'POST',
        'header'  => ['Content-type: application/x-www-form-urlencoded',
                             'Authorization: Bearer xxxxxxx'],
        'content' => http_build_query($payment_basket)
    )
);

$context = stream_context_create($context_options);
$fp = fopen('https://ipaidthat.io/inv/api/activha-webhook/902', 'r', false, $context);
fpassthru($fp);
fclose($fp);

Do you see something that could fail if offline or delayed ?

Please Log in to join the conversation.

4 years 1 month ago - 4 years 1 month ago #316785 by krileon
Replied by krileon on topic Question for CBsubs trigger when offline
It's possible the server you're sending that POST to couldn't be reached for whatever reason, but the trigger should've fired fine. Have you checked server error log around the time the Stripe IPN came through to see if any errors logged?


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.674 seconds

Facebook Twitter LinkedIn