Skip to content

Commit

Permalink
fix up readme
Browse files Browse the repository at this point in the history
  • Loading branch information
morukele committed Sep 18, 2023
1 parent 3d4dbb4 commit a4dcd16
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions README.md
Expand Up @@ -51,36 +51,36 @@ You can also download the source code and use in your code base directly if you
Initializing an instance of the Paystack client and creating a transaction.

```rust
use std::env;
use dotenv::dotenv;
use paystack::{PaystackClient, InitializeTransactionBodyBuilder, Error, Currency, Channel};

#[tokio::main]
async fn main() -> Result<(), Error>{
dotenv().ok();
let api_key = env::var("PAYSTACK_API_KEY").unwrap();
let client = PaystackClient::new(api_key);

let body = InitializeTransactionBodyBuilder::default()
.amount("10000".to_string())
.email("email@example.com".to_string())
.currency(Some(Currency::NGN))
.channels(Some(vec![
Channel::ApplePay,
Channel::Bank,
Channel::BankTransfer
]))
.build()
.unwrap();

let transaction = client
.transaction
.initialize_transaction(body)
.await
.expect("Unable to create transaction");
use std::env;
use dotenv::dotenv;
use paystack::{PaystackClient, InitializeTransactionBodyBuilder, Error, Currency, Channel};

#[tokio::main]
async fn main() -> Result<(), Error>{
dotenv().ok();
let api_key = env::var("PAYSTACK_API_KEY").unwrap();
let client = PaystackClient::new(api_key);

let body = InitializeTransactionBodyBuilder::default()
.amount("10000".to_string())
.email("email@example.com".to_string())
.currency(Some(Currency::NGN))
.channels(Some(vec![
Channel::ApplePay,
Channel::Bank,
Channel::BankTransfer
]))
.build()
.unwrap();

let transaction = client
.transaction
.initialize_transaction(body)
.await
.expect("Unable to create transaction");

Ok(())
}
Ok(())
}
```

## Contributing
Expand Down

0 comments on commit a4dcd16

Please sign in to comment.