New Scheduled / Recurring Payments API! Transaction status and webhooks


(Narayana Amuda) #1

Hi Dwolla Team,

I’m followed ur steps and ur support and able to do the recurring payments by getting funding list and asking the user to enter the pin in our UI and making the scheduled(Recurring) action api call. Its able to create an recurring transaction.

Once the scheduled transaction is done and getting the reposnse. I’m saving the transaction id in my DB for that payment.

How to know the status of this scheduled transaction is success or failed or cancelled by the user from his dwolla account.

I need to update the status of this payment in my DB.

How the webhooks will work and how we can test the webhooks is working or not. I’m implementing using PHP.

When the scheduled transaction is success and payment is transferred to our account i need to update the status. how i can kinow if the user cancelled this recurring process at any time from his DWOLLA account.


(Spencer Hunter) #2

@Narayana_Amuda Fantastic that you were able to successfully create a scheduled/recurring payment!

As a note: scheduled payments will return a unique string identifier, which is a scheduled payment Id and not a transaction Id. However, once the scheduled transaction kicks off you can call Retrieve Scheduled Payment, passing in your scheduled payment Id, to get the transactionId of the created scheduled payment.

You can check the status of a scheduled payment by calling Retrieve Scheduled Payment. Once the scheduled payment is created and there is a transactionId, you can either poll our API for the transaction status or rely on webhooks.

You can set up a TransactionStatus webhook and set your url to a requestb.in, then create a scheduled transaction for tomorrow. Once that scheduled transaction is created you can go back to that requestbin and see if the transaction status webhook was POSTed.

You can rely on webhooks, by setting the ScheduledTransactionChange URL. This will notify your app when a scheduled payment has been deleted/changed.


(Narayana Amuda) #3

$tid = $Dwolla->schedule($destinationId, $amount, $scheduleDate, $fundsSource, $params, $alternate_token,$alternate_pin);
if(!$tid) {
$err_msg=$Dwolla->getError();
}else{
if(isset($tid[‘Error’]) && $tid[‘Error’] !=’’){
$err_msg=$tid[‘Error’];
}else if(isset($tid[‘Status’]) && $tid[‘Status’]==‘scheduled’ && isset($tid[‘Recurrence’][‘Status’])&& $tid[‘Recurrence’][‘Status’]==‘Enabled’ ) {
echo “schedule transaction ID: \n”;
echo “

”;
print_r($tid);
                print_r($Dwolla->scheduledById($tid['Id'],$alternate_token));

Here The both array are same response. I’m not getting any transaction response. even i checked from the dwolla account. I not found any transaction ID for this scheduled payment.

I’m going to schedule the first payment on the next day of when they are doing the action.


(Brandon Ruschill) #4

@spencer:

Once the scheduled payment is created and there is a transactionId…

Does this mean that I can hit the Retrieve Scheduled Payment endpoint immediately after I successfully create a scheduled payment (i.e. getting a response with a status of scheduled) and I’ll be able to retrieve that scheduled payment’s transaction ID?

If not, does the data sent to my TransactionStatus webhook provide both the transaction ID and unique string ID for the scheduled transaction?

Thanks!
Brandon


(Spencer Hunter) #5

Hey @bruschill!

You won’t be able to retrieve the transaction Id immediately after the scheduled payment is created because no transaction exists yet. However, when that scheduled payment successfully kicks off in the future you should be able to call Retrieve Scheduled Payment to get the transaction Id of the created payment.

The data sent via the TransactionStatus webhook will only provide the transaction Id of the payment that was created (and additional info on the payment itself). Once the scheduled/recurring payment kicks off it will treated like a normal Send ACH transaction.


(Chris) #6

Is there documentation for recurring payments with api v2? @spencer


(Spencer Hunter) #7

@cblevvel, As it stands today, scheduled/recurring is only built into our v1 API, however we do have it on our roadmap to add scheduled/recurring functionality into our v2 API at some time in the future. For the time being, if you’re using our v2 API then you’ll want to build your own scheduler and call our Transfers API to initiate the transaction on a specified date. In addition, be sure to follow the payment requirements as outlined in our developer terms of service. Specifically, section 4.4 “Requirements for one-time scheduled and recurring payments.”