= Payment Adapter Implementation

== Extension Lifetime

Payment Adapter extension is loaded as WASI file and initialize as a module.
Then to store it in runtime `name` function is called to load extension unique `name` (`String`).

Using this `name` extension configuration from application configuration, names must match! In config is missing is missing application will print error message is stop.

Then configuration is passed to extension to setup client. If everything goes as expected it should return `Status::Success`, in any other situation it must return `Status::Failure`, this also will cause to print error message and stop application.

Lastly if extension will be be dropped for some reason it will be detached from store and `teardown` function will be called.

1. `name`
2. `init`
3. `teardown`

== Example

[rust]
```
/// Mandatory for WASM runtime
#[no_mangle]
pub fn wapc_init() {
    wapc::register_function("name", name);
    wapc::register_function("init", init);
    wapc::register_function("teardown", teardown);
    wapc::register_function("create_payment", create_payment);
    wapc::register_function("cancel_order", cancel_order);
    wapc::register_function("update_status", update_status);
}
```
