cred_from_env

Function cred_from_env 

Source
pub fn cred_from_env(env_key: String) -> Result<Secret<String>, AuthError>
Expand description

Helper function that looks for Secret Key from your .env file and returns a Secret<String>.

ยงExample

use paystack_transaction::{cred_from_env, PaymentBuilder, Payment};

async fn build() {
    let key = cred_from_env("SECRET_KEY".to_string()).unwrap();

    let builder = PaymentBuilder::init_payment(
        "test@example.com".to_string(),
        100.0,
        key,
    );

    builder.build().send().await.unwrap();
}