CCBILL auto-recurring payment methodology

5 years 4 months ago #309296 by buzibuzi
Replied by buzibuzi on topic CCBILL auto-recurring payment methodology
Hi, more on this matter....
1. How do i get the newly created "subscription_id" that was just inserted to #_cbsubs_subscriptions Table by updatePaymentStatus ?
do i have access to it somehow from the cbpaidsubscriptions.class ?
or do i need to query the DB for the last inserted id ? (least preferred method)

2. i created a recurring plan with 5 minutes expiration date for testing purposes.
so, if i call after first payment
$paymentBasket->scheduleAutoRecurringPayments()
and if all works fine, the processScheduledAutoRecurringPayment should be processing my newly created subscription after 5 minutes, is this correct ?

Thank you

Please Log in to join the conversation.

5 years 4 months ago #309308 by krileon
Replied by krileon on topic CCBILL auto-recurring payment methodology

1. How do i get the newly created "subscription_id" that was just inserted to #_cbsubs_subscriptions Table by updatePaymentStatus ?
do i have access to it somehow from the cbpaidsubscriptions.class ?
or do i need to query the DB for the last inserted id ? (least preferred method)

You can query for it, grab it using API, or loop through the baskets items. Not sure why you need it though.

2. i created a recurring plan with 5 minutes expiration date for testing purposes.
so, if i call after first payment
$paymentBasket->scheduleAutoRecurringPayments()
and if all works fine, the processScheduledAutoRecurringPayment should be processing my newly created subscription after 5 minutes, is this correct ?

The scheduler needs to be triggered, but yes after 5 minutes the plan would flip to an expired state and be renewed by the scheduler which executes processScheduledAutoRecurringPayment. The scheduler URL can be found in CBSubs > Settings > Global. Believe certain frontend actions will also trigger it (e.g. expired user logging in).


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.

5 years 4 months ago #309322 by buzibuzi
Replied by buzibuzi on topic CCBILL auto-recurring payment methodology
"You can query for it, grab it using API, or loop through the baskets items. Not sure why you need it though."
i need to it insert into the record holding the IPN recurring token (the token that replaces the credit card data) so i when the recurring payment is triggered i'll pull the basket from the #_cbsubs_subscriptions Table.

in a certain scenario, if two simultaneous payments are performed, the tokens and baskets might get mixed up. i want to make sure im using the correct subscription_id.

i couldnt find wher ethe baskets items dont hold this subscription_id. could you point me how to grab is using the API ?
Thanks

Please Log in to join the conversation.

5 years 4 months ago #309325 by buzibuzi
Replied by buzibuzi on topic CCBILL auto-recurring payment methodology
Also, one more point:
when running the scheduler URL
index.php?option=com_comprofiler&task=pluginclass&plugin=cbpaidsubscriptions&do=autopayments&key={mykey)
for the first time after the expiration, it ran well and returned with a log info (payment failed, but that's ok)

but when running it again the page returns blank and nothing is recorded in the history log
I tried removing the subscription, paying for it again. waiting for expiration and running again, nothing helps.
is there some restriction on this autopayments url load ? what could explain this ?
how can i debug the autopayments run ?
thanks

Please Log in to join the conversation.

5 years 4 months ago #309327 by buzibuzi
Replied by buzibuzi on topic CCBILL auto-recurring payment methodology
regarding the last point.
i figured out the date-time value in #_cbsubs_payment_baskets.scheduler_next_maturity is recorded one day ahead from when the basket was created. that's why the autopayments didn't complete. because it need to wait 24 hours before running again. im not sure why this is, since the autorecurring is set dynamically. but it probably doesnt matter. i can adjust the #_cbsubs_payment_baskets.scheduler_next_maturity date in the DB to Today and then it runs.
tnx

Please Log in to join the conversation.

5 years 4 months ago #309334 by krileon
Replied by krileon on topic CCBILL auto-recurring payment methodology

i need to it insert into the record holding the IPN recurring token (the token that replaces the credit card data) so i when the recurring payment is triggered i'll pull the basket from the #_cbsubs_subscriptions Table.

Sorry, still don't understand. All the information you need to trigger a payment is already available in the provided functions. You don't send subscription id to a payment processor as the payment processor isn't paying a subscription it's paying a basket. The only ID relevant to a processor is the basket id. Your token should be stored as part of the basket or using cbpaidConfig class if it's reusable (see Stripe for usage of cbpaidConfig).

in a certain scenario, if two simultaneous payments are performed, the tokens and baskets might get mixed up. i want to make sure im using the correct subscription_id.

That shouldn't be possible. Typically you send the basket id with your API call to your payment processor and it sends it back with whatever information it may also include.

i couldnt find wher ethe baskets items dont hold this subscription_id. could you point me how to grab is using the API ?

You don't need the subscription_id as again it's not relevant to the processor. It might not even exist yet as well depending on the state of the basket. Where it is relevant it is provided to the function, which is very few instances (e.g. few cancel functions).

i figured out the date-time value in #_cbsubs_payment_baskets.scheduler_next_maturity is recorded one day ahead from when the basket was created. that's why the autopayments didn't complete. because it need to wait 24 hours before running again. im not sure why this is, since the autorecurring is set dynamically. but it probably doesnt matter. i can adjust the #_cbsubs_payment_baskets.scheduler_next_maturity date in the DB to Today and then it runs.

When it's scheduled should be entirely based off the duration set within the plan. Don't think CCBill allows for 5 minute duration so the gateway maybe forcing it to no less than 1 day duration. Based off your previous reply though it went into retry state. This causes it to retry the next day if the payment failed. It'll do that I think 5 times before giving up.


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: 3.542 seconds

Facebook Twitter LinkedIn