> ## 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.

# Creating Outbound Payment Transactions with ECP

The majority of transactions, real-time or recurring, processed by Subscribe are inbound, as they originate with your customers, and are inbound to your bank. For the ECP payment method, Subscribe also supports real-time outbound transactions, where money is withdrawn from your bank account and deposited into someone else’s account. This may result from payments to customers, or payments to business partners and vendors.

**Note:** Outbound ECP support is available only to clients currently using Chase Paymentech as their processor.

When creating an outbound ECP `Transaction` object:

1. Set the `destPaymentMethod` attribute with an ECP-based `PaymentMethod` object that contains information on the payee’s bank account. Leave the `sourcePaymentMethod` attribute unspecified.
2. Set the `ecpTransactionType` attribute to the value `Outbound`.
3. Point the `Account` attribute to an `Account` object that contains the payee’s information.

```

$txn = new Transaction();
 
 // populate the transaction as shown in the previous example
 
 $paymentMethod = new PaymentMethod();
 $paymentMethod->setBillingAddress($address); 
 $paymentMethod->setType('ECP');
 
 $ecp = new ECP();
 
 // specify the account number where funds will be deposited 
 // (payee's account)
 $ecp->setAccount('123456799'); 
 
 // specify bank routing number (payee's bank)
 $ecp->setRoutingNumber('3409284044');
 $ecp->setAccountType('ConsumerChecking');
 $paymentMethod->setECP($ecp);
 
 // Since this is an outbound payment i.e. a deposit into 
 // payee's bank account and withdrawal from merchant's bank 
 // account, set the destPaymentMethod attribute of the transaction
 
 $tx->setDestPaymentMethod($paymentMethod);
 $tx->setEcpTransactionType('Outbound'); 
 $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->ecpStatus->authCode . "\n";
 }
 }
```

The status changes on outbound transactions are similar to those for ECP inbound transactions. When the status changes to `Captured`, assume that the outbound payment is complete.

**Parent topic:**[Using ECP for One-Time Transactions](../topics/Using_ECP_for_One_Time_T)


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