# Update card status PATCH https://api-sandbox.payabli.com/api/MoneyOutCard/card/{entry} Content-Type: application/json Updates the status of a virtual card (including ghost cards) under a paypoint. Reference: https://docs.payabli.com/developers/api-reference/cards/update-card-status ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: payabliApi version: 1.0.0 paths: /MoneyOutCard/card/{entry}: patch: operationId: update-card summary: Update card status description: >- Updates the status of a virtual card (including ghost cards) under a paypoint. tags: - subpackage_ghostCard parameters: - name: entry in: path required: true schema: $ref: '#/components/schemas/type_:Entry' - name: requestToken in: header required: true schema: type: string responses: '200': description: Success response. content: application/json: schema: $ref: '#/components/schemas/type_:PayabliApiResponse' '400': description: Bad request/ invalid data content: application/json: schema: description: Any type '401': description: Unauthorized request. content: application/json: schema: description: Any type '500': description: Internal API Error content: application/json: schema: description: Any type '503': description: Database connection error content: application/json: schema: $ref: '#/components/schemas/type_:PayabliApiResponse' requestBody: content: application/json: schema: type: object properties: cardToken: type: string description: >- Token that uniquely identifies the card. This is the `ReferenceId` returned when the card was created. status: $ref: '#/components/schemas/type_ghostCard:CardStatus' description: The new status to set on the card. required: - cardToken servers: - url: https://api-sandbox.payabli.com/api - url: https://api.payabli.com/api components: schemas: type_:Entry: type: string description: >- The entity's entrypoint identifier. [Learn more](/developers/api-reference/api-overview#entrypoint-vs-entry) title: Entry type_ghostCard:CardStatus: type: string enum: - Active - Inactive - Cancelled - Expired description: >- The status to set on the card. Not all transitions are valid: `Active` can change to `Inactive`, `Cancelled`, or `Expired`. `Inactive` can change to `Active`. `Expired` can change to `Active` (renews the card). `Cancelled` is terminal and can't be changed. title: CardStatus type_:IsSuccess: type: boolean description: >- Boolean indicating whether the operation was successful. A `true` value indicates success. A `false` value indicates failure. title: IsSuccess type_:Responsedata: type: object additionalProperties: description: Any type description: The object containing the response data. title: Responsedata type_:ResponseText: type: string description: 'Response text for operation: ''Success'' or ''Declined''.' title: ResponseText type_:PayabliApiResponse: type: object properties: isSuccess: $ref: '#/components/schemas/type_:IsSuccess' responseData: $ref: '#/components/schemas/type_:Responsedata' responseText: $ref: '#/components/schemas/type_:ResponseText' required: - responseText title: PayabliApiResponse securitySchemes: ApiKeyAuth: type: apiKey in: header name: requestToken ``` ## SDK Code Examples ```typescript CancelGhostCard import { PayabliClient } from "@payabli/sdk-node"; async function main() { const client = new PayabliClient({ apiKey: "YOUR_API_KEY_HERE", }); await client.ghostCard.updateCard("8cfec2e0fa", { cardToken: "gc_abc123def456", status: "Cancelled", }); } main(); ``` ```python CancelGhostCard from payabli import payabli client = payabli( api_key="YOUR_API_KEY_HERE", ) client.ghost_card.update_card( entry="8cfec2e0fa", card_token="gc_abc123def456", status="Cancelled", ) ``` ```csharp CancelGhostCard using PayabliPayabliApi; using System.Threading.Tasks; namespace Usage; public class Example { public async Task Do() { var client = new PayabliPayabliApiClient( apiKey: "YOUR_API_KEY_HERE" ); await client.GhostCard.UpdateCardAsync( "8cfec2e0fa", new UpdateCardRequestBody { CardToken = "gc_abc123def456", Status = CardStatus.Cancelled } ); } } ``` ```go CancelGhostCard package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api-sandbox.payabli.com/api/MoneyOutCard/card/8cfec2e0fa" payload := strings.NewReader("{\n \"cardToken\": \"gc_abc123def456\",\n \"status\": \"Cancelled\"\n}") req, _ := http.NewRequest("PATCH", url, payload) req.Header.Add("requestToken", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby CancelGhostCard require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/MoneyOutCard/card/8cfec2e0fa") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Patch.new(url) request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"cardToken\": \"gc_abc123def456\",\n \"status\": \"Cancelled\"\n}" response = http.request(request) puts response.read_body ``` ```java CancelGhostCard import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.patch("https://api-sandbox.payabli.com/api/MoneyOutCard/card/8cfec2e0fa") .header("requestToken", "") .header("Content-Type", "application/json") .body("{\n \"cardToken\": \"gc_abc123def456\",\n \"status\": \"Cancelled\"\n}") .asString(); ``` ```php CancelGhostCard request('PATCH', 'https://api-sandbox.payabli.com/api/MoneyOutCard/card/8cfec2e0fa', [ 'body' => '{ "cardToken": "gc_abc123def456", "status": "Cancelled" }', 'headers' => [ 'Content-Type' => 'application/json', 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift CancelGhostCard import Foundation let headers = [ "requestToken": "", "Content-Type": "application/json" ] let parameters = [ "cardToken": "gc_abc123def456", "status": "Cancelled" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyOutCard/card/8cfec2e0fa")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PATCH" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```