---
title: "Creating a Transaction for a Sender"
slug: "creating-a-transaction-for-a-sender"
updated: 2024-10-10T11:18:30Z
published: 2024-10-10T11:18:30Z
canonical: "docs.onespan.com/creating-a-transaction-for-a-sender"
---

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

# Creating a Transaction for a Sender

[Java SDK](/v1/docs/creating-a-transaction-for-a-sender#java-sdk) [.NET SDK](/v1/docs/creating-a-transaction-for-a-sender#net-sdk) [REST API](/v1/docs/creating-a-transaction-for-a-sender#rest-api)

## Java SDK

To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/create-package-behalf-another-user-java-sdk) site.

When creating a transaction or template account managers can manually designate another user in their account as the Sender. That user will then own the transaction or template, and all behaviors will be as if the transaction or template was created by that user.

The following code will do this:

```java
DocumentPackage pkg1 = PackageBuilder.newPackageNamed("Create on behalf of sender - " + System.currentTimeMillis())
        .withSigner(SignerBuilder.newSignerWithEmail("signer1@example.com" )
                .withFirstName("John")
                .withLastName("Smith"))
        .withDocument(DocumentBuilder.newDocumentWithName("document 1")
        		.fromFile("your_file_path")
        		.withSignature(SignatureBuilder.signatureFor("signer1@example.com")
        				.onPage(0)
        				.atPosition(100, 100)
        				.withSize(250, 75)))
        .withSenderInfo(SenderInfoBuilder.newSenderInfo("your_sender_email"))
        .withVisibility(Visibility.ACCOUNT)		//only works for templates
        .build();
```

Note that you do not need to add the new Sender as a recipient.

Once you have done this, create the transaction or template. The following code will do this:

```java
PackageId packageId = eslClient.createPackageOneStep(pkg1);				//package creation
PackageId templateId = eslClient.getTemplateService().createTemplate(pkg1);		//template creation
```

### Results

Once you have created your transaction or template, note the following:

- In the Web UI, the transaction or template will only appear in the designated sender’s folder. This is because your sender is now the owner of the transaction or template.
- The actual creator of the transaction or template will not be added to the transaction or template as a signer. Instead, the new Sender will be.
- If you have set Account Visibility on your template, it will appear in the Use Template” drop-down list.

## .NET SDK

To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/create-package-behalf-another-sender-net-sdk) site.

When creating a transaction or template account managers can manually designate another user in their account as the Sender. That user will then own the transaction or template, and all behaviors will be as if the transaction or template was created by that user.

The following code will do this:

```csharp
DocumentPackage pkg = PackageBuilder.NewPackageNamed("Create on behalf of sender - " + System.DateTime.Now)
        .WithSigner(SignerBuilder.NewSignerWithEmail("signer1@example.com")
                .WithFirstName("John")
                .WithLastName("Smith"))
        .WithDocument(DocumentBuilder.NewDocumentNamed("document 1")
                .FromFile("your_file_path")
                .WithSignature(SignatureBuilder.SignatureFor("signer1@example.com")
                        .OnPage(0)
                        .AtPosition(100, 100)
                        .WithSize(250, 75)))
        .WithSenderInfo(SenderInfoBuilder.NewSenderInfo("your_sender_email"))
        .WithVisibility(Visibility.ACCOUNT)              //only works for templates
        .Build();
```

Note that you do not need to add the new Sender as a recipient.

Once you have done this, create the transaction or template. The following code will do this:

```csharp
PackageId packageId = eslClient.CreatePackageOneStep(pkg);				//package creation
PackageId templateId = eslClient.CreateTemplate(pkg);                                   //template creation
```

### Results

Once you have created your transaction or template, note the following:

- In the Web UI, the transaction or template will only appear in the designated sender’s folder. This is because your sender is now the owner of the transaction or template.
- The actual creator of the transaction or template will not be added to the transaction or template as a signer. Instead, the new Sender will be.
- If you have set Account Visibility on your template, it will appear in the Use Template” drop-down list.

## REST API

To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/create-package-behalf-another-sender-net-rest) site.

When creating a transaction or template account managers can manually designate another user in their account as the Sender. That user will then own the transaction or template, and all behaviors will be as if the transaction or template was created by that user.

The following request below shows you how to build your package JSON in order to assign a new package sender/owner:

#### HTTP Request

```http
POST /api/packages
```

#### HTTP Headers

```plaintext
Authorization: Basic api_key
Accept: application/json
Content-Type: application/json
```

#### Request Payload

```http
{
  "status": "DRAFT",
  "description": "A test transaction for 'sender on behalf of sender'",
  "language": "en",
  "type": "PACKAGE",
  "name": "Sender On Behalf Of Sender",
  "sender": {
    "email": "your_sender_email"
  }
}
```

#### Response Payload

```json
{
    "id": "9sKhW-h-qS9m6Ho3zRv3n2a-rkI="
}
```

To create a template on behalf of your sender, use the following payload, with same API as shown above:

```json
{
  "status": "DRAFT",
  "description": "A test transaction for 'sender on behalf of sender'",
  "language": "en",
  "type": "TEMPLATE",
  "visibility":"ACCOUNT",
  "name": "Sender On Behalf Of Sender",
  "sender": {
    "email": "your_sender_email"
  }
}
```

In this example a minimalist transaction or template was created. If you added a Roles node during this process you do not need to explicitly add the new Sender as a recipient.

### Results

Once you have created your transaction or template, note the following:

- In the Web UI, the transaction or template will only appear in the designated sender’s folder. This is because your sender is now the owner of the transaction or template.
- The actual creator of the transaction or template will not be added to the transaction or template as a signer. Instead, the new Sender will be.
- If you have set Account Visibility on your template, it will appear in the Use Template” drop-down list.
