> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slm.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using EDD and UK DD for One-Time Transactions

For real-time EDD or UK DD-based billing, construct a one-time `Transaction` object and call either the `auth\(\)` or `authCapture()` method on it. If you call `auth()`, capture all the authorized transactions by making the batch `capture()` call later.

If the source payment method of a transaction is of type Direct Debit—the same enumerated `paymentMethodType (value = DirectDebit)`is used for both forms of Direct Debit— the transaction will process through the following status cycle:

1. Subscribe assigns the transaction an immediate status of `Authorized`, indicating that both Subscribe and the payment processor have performed a real-time validation of the payment information, and verified that the bank sort code and account number are not blacklisted. The processor has accepted the transaction, and the deposit process can begin. At this time, no funds are transferred.
2. The payment processor submits the transaction to the payment network for continued processing (withdrawal from the specified bank). The transaction status in Subscribe changes to `AuthorizedPending`, indicating that the deposit process has started.
3. After four banking days have elapsed, Subscribe sets the transaction status to `Captured`. Note that the number of banking days varies between payment processors.

   During the four European banking days:

   * If Subscribe is notified by the payment processor that the transaction failed, that is, received a hard-error reason code from the processor, Subscribe changes the transaction status to `Cancelled`. (For example, if the account specified in the payment method does not exist at the bank in question.)
   * If the payment processor sends Subscribe a soft-error reason code that indicates that there will be an internal retry of the transaction (for example, due to insufficient funds), Subscribe changes the transaction’s status to `DepositRetryPending`. The processor determines when to retry the transaction according to the retry schedule defined by you for your division ID registered with the processor. If the processor does not have such a schedule on file, it hard-fails the transaction, and returns a hard-error reason code. In response, Subscribe changes the transaction status to `Cancelled`.

If during the four European banking days subsequent to the retry attempt, Subscribe does not receive any hard or soft error codes from the processor, Subscribe sets the transaction status to `Captured`.

**Note:** Be sure to send Vindicia your retry schedule by division ID.

The following example constructs a one-time `Transaction` object and calls `authCapture()` on it to process the transaction. This example also verifies that the processor has accepted the transaction for deposit, by ensuring that the immediate status of the transaction after the call is `Authorized`.

To construct a one-time `Transaction` object, substitute the appropriate country code and currency type. Because EDD and UK DD are both direct debit payment methods, routing is determined by country code and currency type. With country code GB and currency GBP, the payment will route to UK DD. With one of the European country codes and the euro or a local currency, payment will route to EDD.

## Use EDD for a one-time transaction

```

$txn = new Transaction();
 
// Populate the transaction with other attributes such
// as account, transaction items, and amount. 
 
// Assume that there is an existing Account with
// the merchantAccountId specified. If mandate storage
// is required for this transaction, this
// account must have a preferred language setting on it.
 
$acct = new Account();
$acct->setMerchantAccountId('lhaff1');
 
$txn->setAccount($acct);
$txn->setAmount(34.99);
$txn->setCurrency('EUR');
$txn->setMerchantTransactionId('MRCH-3402284');
 
// If you are enabling mandate storage for this transaction, 
// include the IP address from which the purchase was made. 
// In some countries the IP address is part
// of the signature on the mandate.
 
$txn->setSourceIp('198.209.56.17');
 
$txItem = new TransactionItem();
$txItem->setSku('5492');
$txItem->setName('Online video access');
$txItem->setPrice(34.99);
$txItem->setQuantity(1);
$txn->setItems(array($txItem));
 
// set EDD as source payment method
 
$paymentMethod = new PaymentMethod();
 
$bill_addr = new Address();
$bill_addr->setName('Lutz Haff');
$bill_addr->setAddr1('Leonrodstrasse 57');
$bill_addr->setCity('Munchen');
$bill_addr->setPostalCode('D-80636');
$bill_addr->setCountry('DE');
 
$paymentMethod->setBillingAddress($bill_addr); 
$paymentMethod->setType('DirectDebit');
 
$dd = new DirectDebit();
 
// specify the account number from which funds will be withdrawn 
$dd->setAccount('8888888888'); 
 
// specify bank sort code of the bank from which funds will 
// be withdrawn
$dd->setBankSortCode('12345678');
 
$dd->setCountry('DE'); 
// needed for Vindicia's internal validation
 
$paymentMethod->setDirectDebit($dd);
 
// If this is an inbound payment, i.e. a withdrawal from a 
// specified bank account, and a deposit into the 
// merchant's account, set the source payment method in the 
// transaction.
// Outbound payments (from the merchant's bank account to the 
// customer’s), defined by setting the destination
// payment method in the transaction, are not supported.
 
$tx->setSourcePaymentMethod($paymentMethod);
 
$sendEmailNotification = false;
 
$response = $tx->authCapture($sendEmailNotification);
 
if($response['returnCode']==200) {
if($tx->statusLog[0]->status=='Authorized') {
print "Successful\n";
}
else if($tx->statusLog[0]->status=='Cancelled') {
// The transaction did not go through
print "Declined. Reason code received from payment processor: ";
print $tx->statusLog[0]->status->directDebitStatus
->authCode . "\n";
}
}
```

After initial authorization of the real-time transaction, monitor the transaction’s subsequent status changes by either looking it up on the Subscribe Portal, or by calling one of the `Transaction` object’s `fetch` methods. For details, see Section 18: The Transaction Object in the **Subscribe API Guide**.

**Note:** Outbound payment transactions are those in which you have set the `destPaymentMethod` attribute to pay your customers. EDD does not support outbound transactions.

* **[Understanding Mandates for Real-Time Billing with EDD](../topics/Understanding_Mandates_f_2)**

* **[Understanding Mandates for Real-Time Billing with UK DD](../topics/Understanding_Mandates_f_3)**

**Parent topic:**[Working with One-Time Transactions](../topics/ProgGuide_Transactions)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.